Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Undefined function. Can anyone plz help me!
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I followed the textbook and type the exact code. But still it doesn't work. I can not find anything wrong from it, just can not understand why the solution function could not be generated? Can anyone plz help me! Thanks!
num=[100];
den=[0.36 1.86 2.5 1];
K=[2.0 2.2 2.4 2.6 2.8 3.0];
a=[0.5 0.7 0.9 1.1 1.3 1.5];
t=0:0.01:5;
g=tf(num,den);
k=0;
for i=1:6;
for j=1:6;
gc=tf(K(i)*[1 2*a(j) a(j)^2],[1 0]);
G=gc*g/(1+gc*g);
y=step(G,t);
m=max(y);
if m<1.10
k=k+1;
solution(k,:)=[K(i) a(j) m];
end
end
end
The outcome should be that when I type solution in the command window and a table of figures will be generated, however what I got is just the remind that Undefined function or variable 'solution'.
0 Commenti
Risposte (1)
Image Analyst
il 2 Mar 2015
This line:
solution(k,:)=[K(i) a(j) m];
never gets executed. Use the debugger to figure out why. This is something you will absolutely have to learn to do if you want to write programs in MATLAB. All of us do it, you need to too.
2 Commenti
Image Analyst
il 2 Mar 2015
I have no idea why you put that if statement in there. This is what happens when you don't put comments in your code - other people can't maintain your code for you. Why is the if statement in there in the first place? If you don't want it, take it out. I have no idea if it's supposed to be there or not.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!