Answered
Function doesn't return a vector from a vector input
‘Could someone tell me my mistake?’ You need to use the any or all functions in the if statements, depending on what you want...

7 years ago | 1

| accepted

Answered
Bode Plot - trasnfer function
Try this (your code slightly edited): s = tf('s'); G = ((1+s*1E-3))/((s*1E-2)*(1+s*1E-1)*(1+s*1E-5)); bode(G) ...

7 years ago | 1

| accepted

Answered
Failure in initial objective function evaluation. FSOLVE cannot continue.
The ‘Y’ evaluation is missing a few multiplication(?) operators, and needs to do element-wise operations elsewhere: Y = B-((Q1...

7 years ago | 0

Answered
Question on how to use scatter3
The ‘Z’ vector can be anything, providing it is a vector of the same size as the others. Setting it equal to: Z = zeros(size(...

7 years ago | 0

| accepted

Answered
How do I plot these for loops?
Put them all in subplots, with the appropriate indexing: tspan = linspace(0, 5, 25); for k=1:5 y0 = 0; [t,y(:,k)] = ode45(@...

7 years ago | 0

| accepted

Answered
Other alternative than syms for differentiation and integration?
MATLAB is case-sensitive, so X ~= x. Try this: syms x; fun = x^3+2*x+10; dfundx = diff (fun,x); producing: dfundx = 3...

7 years ago | 0

Answered
Solving non linear equations sytem
The Symbolic Math Toolbox is not optimal for such problems. It is likely not worth the effort to see if a symbolic solution exi...

7 years ago | 2

Answered
undefined variable error when the variable is there
Please note that: l ~= 1 You typed: for i = l:length(t) for j = l:length(x) however I believe you intended: for i =...

7 years ago | 0

| accepted

Answered
t(j) is coming up as an error when trying to graph values. what am i doing wrong
It doesn’t appear that you have defined ‘j’ anywhere before the loop. One possibility: iv = 0:0.1:t1; for j = 1:numel(iv) ...

7 years ago | 0

| accepted

Answered
Loop Trough Time t = t+dt
You have encountered floating-point approximation error. See the documentation section on Floating-Point Numbers, and the col...

7 years ago | 2

Answered
find(vector==value) not working
You have encountered floating-point approximation error. See the documentation on Floating-Point Numbers for a full explanation...

7 years ago | 2

| accepted

Answered
Variable inside an ode
Try this: SA = @(t) 0.00155+(0.06043-0.0015)./(1+(t/4481.23119).^0.85949); f = @(t,Cb) SA(t)*D/(h*DV)*(Cs-Cb) The rest of yo...

7 years ago | 0

| accepted

Answered
Linear best fit through specified y-axis intercept
Try this: x = linspace(0.7, 1.7, 5); % Create Data (Use Your Own ‘x’ & ‘y’) y = randn(1,5); ...

7 years ago | 0

Answered
How can I smooth this plot?
Try this: [D,S] = xlsread('Book1.xlsx'); signal = D(:,1); L = size(signal,1); Fs = 1; ...

7 years ago | 0

| accepted

Answered
Warning: The closed-loop system is unstable.
The system has a pole-zero cancellation at the origin: s = tf('s'); ctf = (10*s^3 + 1100*s^2 + 10000*s) / (s^4 + 210*s^3 + ...

7 years ago | 0

Answered
Lines in legend are missing
This appears to be a problem with current AMD graphics card drivers. The easiest solution seems to be: opengl('software') ...

7 years ago | 16

| accepted

Answered
How to fit data on only one ordinary differential equations (out of multiple equations) with multiple unknown parameters
The lsqcurvefit function allows you to set upper and lower bounds on the parameters it estimates with the ‘lb’ and ‘ub’ vectors....

7 years ago | 0

| accepted

Answered
Weighted fit with lsqcurvefit and (ideally) multistart?
I doubt that weighting is appropriate, and I would not recommend doing that. I recognise that code excerpt, so I am attaching...

7 years ago | 0

| accepted

Answered
Why isn't my graph plotting correctly?
Set the peaks values to NaN and they will not plot: km=linspace(0,10,1000); y=tan(km)+tanh(km); [pks,locs] = findpeaks(y); ...

7 years ago | 0

Answered
Contour plot using three vectors
I thought we already solved that in Contour plot of concentration of chemical species ? Apparently I did not explain this s...

7 years ago | 6

| accepted

Answered
use of signtest function
From the documentation: [p,h] = signtest(___) also returns a logical value indicating the test decision. The value h = 1...

7 years ago | 0

| accepted

Answered
Interpolate a set of points
I am not certain what you want. The figure produced by this code appears quite similar to your original plot image: D = rea...

7 years ago | 0

| accepted

Answered
how do I plot temperature contours on a PV diagram?
Try this example — Tv1 = linspace(273, 323, 10); Tv2 = linspace(323, 373, 10); Vv1 = linspace(150, 200, 10); [T1m,V1m] = nd...

7 years ago | 0

Answered
I am trying to plot a function with iteration of a variable
Try this: a = .0022; %m d = .05*a; %m viscosity_p = 1.2; %cP viscosity_c = 3.5; %cP dpdz1 = -10; %mmHg dpdz2 = -1.3; %kPa...

7 years ago | 0

Answered
Intersection between ellipse and circle
Try this: %ellipse e=0.284576477148; %eccentricity a=0.803468308684*150*10^6; c=e*a; b=sqrt(a^2-c^2); %parameters of ellipse...

7 years ago | 2

| accepted

Answered
Shortcuts for symbols not recognized
It depends on how and where you want to use them. To use them in plots, use the text function, and particularly see the section...

7 years ago | 0

Answered
lsqcurvefit: is the output of this function unique for a given set of initial conditions (and deterministic model)?
All nonlinear parameter estimation algorithms are sensitive to the initial parameter estimates. It is quite possible that they ...

7 years ago | 0

Answered
Plot a straight line on another graph
It looks as though you want to plot tangent lines at specific points on the curve. See How to draw tangent line at infleciton p...

7 years ago | 0

| accepted

Answered
how to plot this equation?
Try this: t = linspace(0, 5000, 250); % Choose Appropriate Limits y = 10.1556-9.10862*exp(-0.0010...

7 years ago | 0

Answered
Printing a variable within an input command
Assuming ‘current_player’ is a character array or string variable: move = input(sprintf('Player %s, choose column 1-7 to drop ...

7 years ago | 0

Load more