Reputation: 27
everybody,
I have a new problem with matlab, I want to generate a graph using Plot !
I wrote that:
X=[0, 2.5];
P = 0.1 * ones(N,11);
N=length(X);
for n=1:N
for t=1:10
P(n,t+1)=X(n)*P(n,t)*[1-P(n,t)];
end
end
plot(t,P)
But again the computer answer me that :
??? Error using ==> plot
Vectors must be the same lengths.
Error in ==> test at 10
plot(t,P)
I do not have any idea of why ?
Upvotes: 1
Views: 952
Reputation: 7132
The variable t in your plot command is no a vector but just the scalar 10. You have to call the plot command instead with
plot(1:11,P);
Upvotes: 2