Answered
How do I use the lsqcurvefit to find the best fit for my data?
If you want to fit your differential equation to your data, see <http://www.mathworks.com/matlabcentral/answers/43439-monod-kine...

9 years ago | 0

Answered
Executing 'datetick' shifts plot, no longer lines up with x-axis
The <https://www.mathworks.com/help/matlab/ref/datetick.html *|datetick|*> (link) function has *|'keeplimits'|* and *|'keepticks...

9 years ago | 0

| accepted

Answered
How to draw lines on a slice graphic?
For lines in 3D plots, see if the <https://www.mathworks.com/help/matlab/ref/plot3.html *|plot3|*> (link) function will do what ...

9 years ago | 0

| accepted

Answered
Problem with MATLAB "exist", returning 0, although the file actually exists!
I always use the <https://www.mathworks.com/help/matlab/ref/which.html *|which|*> (link) function to find files, since it return...

9 years ago | 1

Answered
Sorting cell array by date
Your data are already sorted: D = load('sort-by-2nd-column.mat'); Data = D.GivenData; [dn,idx] = sort(datenum(Data(2...

9 years ago | 2

| accepted

Answered
Variable in input prompt
Use a *|sprintf|* call: input_matrix(2:3,n) = input(sprintf('Enter the Mass and Volume in brackets [Mass Volume] of Object...

9 years ago | 3

Answered
normrnd function not working
The *|normrnd|* function is in the Statistics and Machine Learning Toolbox. You must have it downloaded and installed to have a...

9 years ago | 1

| accepted

Answered
How to make a stacked area chart , where x axis is the datetime variable
Use the <https://www.mathworks.com/help/matlab/ref/datetick.html *|datetick|*> (link) function: Y = [730301, 1, 5, 3; ...

9 years ago | 1

| accepted

Answered
IIR Bandpass Filter - Numerical Precision Causing Instability?
The problem _could_ be with the way you are designing the filter. Some functions are better than others (I prefer the *|‘z,p,...

9 years ago | 1

| accepted

Answered
How to draw a rectangle in a segmented region?
I would use *|regionprops|* with the *|'BoundingBox'|* argument, then take the box with the largest area, and draw it: RP ...

9 years ago | 0

Answered
Split a series of lines into equal parts
Use the *|arrayfun|* function: dn_n = arrayfun(@(x)linspace(0,x,10), x(2:end)', 'Uni',0); % Cell Array dn_n = cell...

9 years ago | 0

| accepted

Answered
compare a vector with every cells element and get the missing
Use *|setdiff|* inside *|cellfun|*: V = 1:100; C = {randi(100, 1, 75)}; % Create ‘C’ ...

9 years ago | 1

| accepted

Answered
How to change vaules on X axis on a plot
Try this: x = 0:1300; % Create Data y = -2.1*x; ...

9 years ago | 6

| accepted

Answered
Problems plotting a function
First, define *|‘h’|* as: h = 1.0545718E-34; Second, see if this does what you want: x = linspace(-10*pi, 10*...

9 years ago | 0

Answered
combine two double cells into 1
This works, and _should_ work with your entire *|‘C1’|* and *|‘C2’|*: C1{1} = [1 2 3 4]; C1{2} = [1 2]; C2{1} = [5 2...

9 years ago | 2

Answered
How do I solve this index out of bounds error?
If I’m counting correctly, *|‘Line 14’|* is your *|ode45|* call. First, forget the *|global|* variables. They are likely a...

9 years ago | 0

Answered
NOT ENOUGH INPUT ARGUMENTS
It works correctly for me when I give it the correct arguments: A = [1 2]; B = [2 3]; C = [3 1]; [I,r]=in...

9 years ago | 1

Answered
Extract 2 rows each to be stored in column.
Try this: R = reshape(A, 2, []); B = mat2cell(R, 2, ones(1,size(R,2))); Check = [B{:}] ...

9 years ago | 1

Answered
Integrating and graphing in 3
You can integrate it with the Symbolic Math Toolbox. The plot is not very interesting: syms x f(x) = (((6.4)/(x+1...

9 years ago | 0

Answered
Creating timeseries using date num
The *|datenum|* function returns days and fractions of days. Try this: data = datenum(2007,1,1,0,0,0) : 1/12 : da...

9 years ago | 0

| accepted

Answered
How to assign gaussian random numbers on meshgrid?
Try this: nx=6; ny=6; [x,y]=meshgrid(1:nx,1:ny); zg = randn(size(x)); % Gaussian Rando...

9 years ago | 0

Answered
How can I plot 2D temperature.
Without your data or calculations, providing specific code is not possible. You may have to calculate your data in polar co...

9 years ago | 0

| accepted

Answered
Where is the ellipticf function?
It’s there, and will respond if you call it correctly. MATLAB is case-sensitive: s = [ellipticF(pi/3, -10.5), ellipti...

9 years ago | 1

| accepted

Answered
TF = isoutlier(A,method) on older MATLAB version (2011b) ?
For *|R2016a|*, if you have the Signal Processing Toolbox, you can use the <https://www.mathworks.com/help/signal/ref/hampel.htm...

9 years ago | 0

Answered
Find size and number of ~nan areas of array
If you have the Image Processing Toolbox, I would be tempted to use the <https://www.mathworks.com/help/images/ref/regionprops.h...

9 years ago | 2

| accepted

Answered
Power Spectral density plot in a certain frequency range
Use the <https://www.mathworks.com/help/matlab/ref/axis.html *|axis|*> (link) function: h1 = plot(Hpsd); set(h1,'Color'...

9 years ago | 0

Answered
how to write code for this equation?
You need *|‘x’|* to be longer, and you need to reverse the arguments to your *|plot|* call. (The *|axis|* call is not absolutel...

9 years ago | 1

| accepted

Answered
search multiple results for multiple conditions
I would use the <https://www.mathworks.com/help/stats/pdist.html *|pdist|*> (link) function. You can use ordinary matrix indexi...

9 years ago | 0

Answered
how to find time interval of peak value in a timeseries ?
If you want to interpolate to find the ‘exact’ time, this works: t = 0 : 30 : 1440; LD = 500 + 400*sin(2*pi*t/2880); ...

9 years ago | 1

| accepted

Answered
How can I create a matrix from three columns?
See the documentation on the <https://www.mathworks.com/help/matlab/ref/xlsread.html *|xlsread|*> (link) function.

9 years ago | 0

Load more