plot and surf 3D graph
3 ビュー (過去 30 日間)
古いコメントを表示
dear all, i am a new learner of matlab and was given a assignment to solve a matlab programming question. some errors occur and i unable to plot 3D graph. the error shown is as follow:
??? Error using ==> plot
Data may not have more than 2 dimensions
Error in ==> aaa at 28
subplot(2,2,1), plot(sseff);
the work that I did is as follow:
for Kp = 1:1:3
for tau = 1:1:3
for theta = 1:1:3
for lambda = 1:1:3
%Tuning the controller
Kc(Kp, tau, theta, lambda) = (2*tau+theta)/2*Kp*(lambda+theta);
taui(tau, theta)= tau+theta/2;
taud(tau, theta)= tau*theta/(2*tau+theta);
num = Kp;
den = [tau 1];
sp = 1;
[numCL,denCL]=cloop(Kc(Kp, tau, theta, lambda)*num*theta,den, -1);
t=0:0.01:5;
y = step(numCL, denCL,t);
sse = (sp - y);
ssef =sum(sse'*sse);
sseff(Kp, tau, theta, lambda) = ssef
end
end
end
end
subplot(2,2,1), plot(sseff);
title('Plot of SSE with multiple values of Tau')
ylabel('Sum of Square Error')
xlabel('Tdelay')
grid;
subplot(2,2,2), surf(sseff')
title('Plot of Sum of Square Error')
ylabel('Tau')
xlabel('Tdelay')
zlabel('Sum of Square Error')
subplot(2,2,3),plot(Kc)
title('Plot of Gain Kc')
xlabel('Tdelay')
ylabel('Sum of Square Error')
grid;
subplot(2,2,4),surf(Kc')
title('Plot of Kc with multiple values of Tau')
ylabel('Tau')
xlabel('Tdelay')
zlabel('Sum of Square Error')
so can anyone help me to find out what are the errors and the correct answers? thank you. My email address: siewchin0911@yahoo.com
0 件のコメント
回答 (1 件)
Fangjun Jiang
2011 年 11 月 9 日
The error message says it all. Data used in plot() may not have more than 2 dimensions. Your data sseff seems to have a dimension of 4.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!