Why is my plot not showing anything?
2 views (last 30 days)
I double checked the equation with a graphing calculator to verify that the plot window is appropriate. There are no syntax error messages, and to my knowledge, there is nothing glaringly incorrect about the syntax.
My code is pasted below:
x = linspace(0,10,1); %Assume the time is from 0 to 10 seconds
%Step response of a 1st-order ODE
% For the 1st order relationship, assume that:
%y_0 = 1
%Tau = 5
y_0 = 10;
Tau = 3;
y = y_0 * (1 - exp((-1*x)/Tau));
Thank you for your time, and I appreciate anyone who can point out what I'm doing wrong. I'm new to MATLAB so I apologize if the mistake is obvious.
Geoff Hayes on 17 Jun 2022
@Aarya O - consider this line
x = linspace(0,10,1);
where you say that you want 1 linearly spaced item between 0 and 10. So this means that x is just 10...and so you are plotting one point only. Try changing this to
x = linspace(0,10,100);
and you should see something different.