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

3 vues (au cours des 30 derniers jours)
Taniya
Taniya le 25 Avr 2023
Commenté : Taniya le 25 Avr 2023
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 commentaires
ARHUM AHMAD
ARHUM AHMAD le 25 Avr 2023
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)
Taniya
Taniya le 25 Avr 2023
thank you, its worked

Connectez-vous pour commenter.

Réponse acceptée

Torsten
Torsten le 25 Avr 2023
Déplacé(e) : Torsten le 25 Avr 2023
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)

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by