plot and surf 3D graph
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Fangjun Jiang
on 9 Nov 2011
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 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!