plot and surf 3D graph

조회 수: 2 (최근 30일)
siew chin cheu
siew chin cheu 2011년 11월 9일
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

답변 (1개)

Fangjun Jiang
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.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by