Answered
Assigning specific elements of vector a different value
See if this works for you: r = [1,3,4,5,3,3,4,5,6,4]; % Given Data Postdia = [12,20]; ...

9 years ago | 1

| accepted

Answered
Skip legend with empty line
Try this: h1 = plot([], 'DisplayName','want to withdraw this if line unexist'); % Blue line hold on; h2 = plot(...

9 years ago | 2

| accepted

Answered
I have imported data from excel and want to count the first lot of zeros in the 6th column
It would help to have your data. This approach will give you the starting index of the last string of zero values: v ...

9 years ago | 0

Answered
why i am getting too many input arguments
The reason is that you have defined *|‘f’|* to be a function of *|‘x’|* only: f= @(x) (-0.5*x.^4)+(4*x.^3)-(10*x.^2)+(8.5*...

9 years ago | 0

| accepted

Answered
How to draw first order best fit in case of hold on figure?
Try this: x = [9.384,39.27]; Y1 = 6.49e-12 * x.^(-4); Y2 = 4.36e-10 * x.^(-5); Y3 = 1.69e-10 * x.^(-4.3); ...

9 years ago | 0

| accepted

Answered
How do I find the phase delay between two signal?
With respect to the delay, see if the <http://www.mathworks.com/help/signal/ref/finddelay.html *|finddelay|*> (link) function wi...

9 years ago | 2

| accepted

Answered
Solve symbollically a 1st order ODE with non-constante coefficient - dsolve
When I declare *|‘u_x’|* as *|‘u_x(z)’|*, (in *|R2017b|*) I get: syms mu(z) theta u_o Kx Ky h z rho w u_x(z...

9 years ago | 1

| accepted

Answered
how to return column index in matrix
Use the *|min|* function with *|2|* outputs: M = [8 1 6 3 5 7 4 9 2]; [~,id...

9 years ago | 1

Answered
alternate for 'ss' for state space representation
For a _linear, time-invariant_ *|(LTI)|* system, create your *|‘A’|*, *|‘B’|*, and *|‘C’|* matrices (and *|‘D’|* if necessary) a...

9 years ago | 0

Answered
how do I create a handle to a plot without plotting?
Try this: fh = figure(1); set(fh, 'Visible','off') plot(rand(1,10), rand(1,10), 'p') Then later, when you want to...

9 years ago | 1

Answered
Plot a circle and a vector moving around it
Try this slight variation on your code: figure(1) AxH = axes('NextPlot', 'add'); plot(x,y) % circle for i = 1:l...

9 years ago | 1

Answered
Place a 2d contour plane in a 3rd axes
See if the <https://www.mathworks.com/help/matlab/ref/contour3.html *|contour3|*> (link) function will do what you want.

9 years ago | 0

Answered
Why when I run my matlab it doesn't work?
One possibility could be due to <https://www.mathworks.com/help/matlab/graphics-changes-in-r2014b.html *Graphics Changes in R201...

9 years ago | 0

Answered
Plotting a Step Function
Try this: f = @(t,T,x,q) (1.*((q.*T <= t ) & (t < (q+x).*T))) + (0.*(((q+x).*T <= t) & (t < (q+1).*T))); q = 1; ...

9 years ago | 1

Answered
how can i find the slope for every six rows of my data
One approach: WindTime = [(0:(1/6):5-(1/6))' rand(30,1)]; % Time (Col#1), Velocity (Col#2) WindReshape = re...

9 years ago | 1

| accepted

Answered
How to find zero on plot?
When I plotted your function, there is only _one_ zero. I would plot it as: f = @(x) exp(-sin(x)) - x; xz=fzero(f,1); ...

9 years ago | 0

| accepted

Answered
Plotting a Parametric Curve with a Double
I would just use *|plot3|* with a slight variation on your posted code: plot3(t, -4*ones(size(t)), t.^2+17) grid on ...

9 years ago | 0

Answered
How to fit parameters to differental equations?
You can likely adapt the approach in <http://www.mathworks.com/matlabcentral/answers/43439-monod-kinetics-and-curve-fitting *Mon...

9 years ago | 1

| accepted

Answered
How to shade area under the curve between two X axis indices?
I am _guessing_ what you want. Try this: x = linspace(0, 10*pi); % Create Dat...

9 years ago | 0

| accepted

Answered
What wrong with the code?
I would subscript *|‘x’|* as *|‘x(i)’|* here, rather than using *|‘x(1)’|*: z = sum(find(y == x(i)))

9 years ago | 0

| accepted

Answered
fit to cos^2
Try this: x=data(:,1); y=data(:,2); objfcn = @(b,x) b(1) .* cosd(b(2).*x + b(3)).^2 + b(4).*x + b(5); NRCF = ...

9 years ago | 0

Answered
Issue with finding the peaks of a graph.
I cannot figure out what you are doing, and specifically what *|‘autom’|* returns. Try this instead: plot(locs,pks,'k...

9 years ago | 1

| accepted

Answered
how to do product summation
I would create vectors out of the *|‘L’|* and *|‘D’|* values, then multiply them using vector/matrix multiplication: L1=1;...

9 years ago | 1

| accepted

Answered
How to create a second order linear model in MATLAB if I have 5 predictors?
I am not certain what you are asking. If by ‘second order linear model’ you are describing a quadratic, this may do what yo...

9 years ago | 0

Answered
Data interpolation from two different text files
I would use the <https://www.mathworks.com/help/matlab/ref/interp1.html *|interp1|*> (link) function. I selected a subset o...

9 years ago | 0

| accepted

Answered
how to use quad ?
We cannot run your code. However, you appear to be integrating a function with *|3|* equal-sized vectors, *|‘alfa’|*, *|‘w1...

9 years ago | 0

Answered
can i run matlab on the Intel Atom x5-Z8350 Processor ( 1.44GHz 1600MHz 2MB ) with 4 GB RAM .
See: <http://www.mathworks.com/support/sysreq/current_release/ *System Requirements for MATLAB*> (link), and <http://www.mathwor...

9 years ago | 0

Answered
How can I remove for loop in the following code that change the entries of a given vector?
Try this: A=[-1;3;-2;-4]; B = A; B(A<0) = -A(A<0)

9 years ago | 1

| accepted

Answered
Semilogy not plotting onto log scale MATLAB R2017b
It *_is_* plotting correctly. Try this, that includes a third *|subplot|* that does a linear plot of the log of *|‘Temperat...

9 years ago | 0

Answered
How to convert a matrix into a vector
You did not state the result you want. One obvious option is to use the <https://www.mathworks.com/help/matlab/ref/reshape.html...

9 years ago | 1

| accepted

Load more