Hi all, can anyone please help to create code for the condition bellow

x = 10:20:200
y = 0.1:0.08:1
[X,Y] = meshgrid(x,y)
I = eye(13,10)
Z = 8.1.*0.7.*X when, X <= 60
else
Z =8.1.*42.*I ,X>60
mesh(X,Y,Z)
figure;
surf(X,Y,Z)

댓글 수: 2

I hope its helpful;
x = 10:20:200
y = 0.1:0.08:1
[X,Y] = meshgrid(x,y)
I = eye(13,10)
Z = [];
for i = 1:12
for j = 1:10
if X(i,j) <= 60
Z(i,j) = 8.1.*0.7.*X(i,j);
else
Z(i,j) =8.1.*42.*I(i,j);
end
end
end
mesh(X,Y,Z)
figure;
surf(X,Y,Z)
thank you, its worked

댓글을 달려면 로그인하십시오.

 채택된 답변

Torsten
Torsten 2023년 4월 25일
이동: Torsten 2023년 4월 25일
x = 10:20:200;
y = 0.1:0.08:1;
[X,Y] = meshgrid(x,y);
Z = zeros(size(X));
Z(X<=60) = 8.1.*0.7.*X(X<=60);
Z(X>60) = 8.1.*42;
mesh(X,Y,Z)
figure;
surf(X,Y,Z)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Geographic Plots에 대해 자세히 알아보기

질문:

2023년 4월 25일

댓글:

2023년 4월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by