Choosing the Axis for Interp2?
24 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shelton Ware
am 26 Mai 2022
Beantwortet: Star Strider
am 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 Kommentare
Akzeptierte Antwort
Star Strider
am 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


