For Loop not plooting with "surf" command
조회 수: 5 (최근 30일)
이전 댓글 표시
I am currently having an issue with getting a "surf" plot to be created. I am recieving an error message. Below i have attatched my code.
clc
Ma = zeros();
Pi = 0; Pinc = 10; Pf = 200; Xi = 0; Xinc = 1; Xf = 180;
for P = Pi:Pinc:Pf;
for X = Xi:Xinc:Xf;
F = (6000)/((sind(X)*33)-(cosd(X)*25));
j= P + 1;
x= X + 1;
Ma(j,x)= -6000+(P*sind(X)*33)-(P*cosd(X)*25);
end
end
[X,P]=meshgrid(Xi:Xinc:Xf,Pi:Pinc:Pf);
figure
surf(X,P,Ma)
댓글 수: 0
채택된 답변
Mehmed Saad
2020년 3월 31일
Try this
clc
Ma = zeros();
Pi = 0; Pinc = 10; Pf = 200; Xi = 0; Xinc = 1; Xf = 180;
for P = Pi:Pinc:Pf;
for X = Xi:Xinc:Xf;
F = (6000)/((sind(X)*33)-(cosd(X)*25));
j= P/Pinc + 1; % changed this
x= X + 1;
Ma(j,x)= -6000+(P*sind(X)*33)-(P*cosd(X)*25);
end
end
[X,P]=meshgrid(Xi:Xinc:Xf,Pi:Pinc:Pf);
figure,surf(X,P,Ma)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!