Choosing the Axis for Interp2?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Shelton Ware
le 26 Mai 2022
Réponse apportée : Star Strider
le 26 Mai 2022
I do not understand why I cannot switch the axis that the interp2 function runs on?
As you can see with the code below I am attempting to get a cross section in the "X-Z" plane instead of the "Y-Z" as shown in the first block.
X=-1:0.1:1;
Y=-1:0.1:1;
Z=membrane(1,10,10);
figure(1)
surf(X,Y,Z);
x=-0.5;
z=interp2(X,Y,Z,x,Y);
figure(2)
plot(Y,z);
y=-0.5;
z1=interp2(X,Y,Z,y,X);
figure(3)
plot(X,z1)
0 commentaires
Réponse acceptée
Star Strider
le 26 Mai 2022
X=-1:0.1:1;
Y=-1:0.1:1;
Z=membrane(1,10,10);
figure(1)
surf(X,Y,Z);
xlabel('X')
ylabel('Y')
x=-0.5;
z=interp2(X,Y,Z,x,Y);
figure(2)
surf(X,Y,Z)
hold on
plot3(ones(size(X))*x,Y,z, '-r', 'LineWidth',3);
hold off
xlabel('X')
ylabel('Y')
y=-0.5;
z1=interp2(X,Y,Z,X,y);
figure(3)
surf(X,Y,Z)
hold on
plot3(X,ones(size(Y))*y,z1, '-r', 'LineWidth',3);
hold off
grid on
xlabel('X')
ylabel('Y')
.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations 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!