a 3d plot but in a specific range

4 views (last 30 days)
Saim
Saim on 7 Nov 2022
Edited: KSSV on 7 Nov 2022
I have the code:
clear all
clc
close all
[x,y] = meshgrid(1:0.2:10);
psi_19 = (2*x) + y - (x*y) - 2
psi_19 = 46×46
1.0e+03 * -1.7148 -1.7144 -1.7140 -1.7136 -1.7132 -1.7128 -1.7124 -1.7120 -1.7116 -1.7112 -1.7108 -1.7104 -1.7100 -1.7096 -1.7092 -1.7088 -1.7084 -1.7080 -1.7076 -1.7072 -1.7068 -1.7064 -1.7060 -1.7056 -1.7052 -1.7048 -1.7044 -1.7040 -1.7036 -1.7032 -1.7146 -1.7142 -1.7138 -1.7134 -1.7130 -1.7126 -1.7122 -1.7118 -1.7114 -1.7110 -1.7106 -1.7102 -1.7098 -1.7094 -1.7090 -1.7086 -1.7082 -1.7078 -1.7074 -1.7070 -1.7066 -1.7062 -1.7058 -1.7054 -1.7050 -1.7046 -1.7042 -1.7038 -1.7034 -1.7030 -1.7144 -1.7140 -1.7136 -1.7132 -1.7128 -1.7124 -1.7120 -1.7116 -1.7112 -1.7108 -1.7104 -1.7100 -1.7096 -1.7092 -1.7088 -1.7084 -1.7080 -1.7076 -1.7072 -1.7068 -1.7064 -1.7060 -1.7056 -1.7052 -1.7048 -1.7044 -1.7040 -1.7036 -1.7032 -1.7028 -1.7142 -1.7138 -1.7134 -1.7130 -1.7126 -1.7122 -1.7118 -1.7114 -1.7110 -1.7106 -1.7102 -1.7098 -1.7094 -1.7090 -1.7086 -1.7082 -1.7078 -1.7074 -1.7070 -1.7066 -1.7062 -1.7058 -1.7054 -1.7050 -1.7046 -1.7042 -1.7038 -1.7034 -1.7030 -1.7026 -1.7140 -1.7136 -1.7132 -1.7128 -1.7124 -1.7120 -1.7116 -1.7112 -1.7108 -1.7104 -1.7100 -1.7096 -1.7092 -1.7088 -1.7084 -1.7080 -1.7076 -1.7072 -1.7068 -1.7064 -1.7060 -1.7056 -1.7052 -1.7048 -1.7044 -1.7040 -1.7036 -1.7032 -1.7028 -1.7024 -1.7138 -1.7134 -1.7130 -1.7126 -1.7122 -1.7118 -1.7114 -1.7110 -1.7106 -1.7102 -1.7098 -1.7094 -1.7090 -1.7086 -1.7082 -1.7078 -1.7074 -1.7070 -1.7066 -1.7062 -1.7058 -1.7054 -1.7050 -1.7046 -1.7042 -1.7038 -1.7034 -1.7030 -1.7026 -1.7022 -1.7136 -1.7132 -1.7128 -1.7124 -1.7120 -1.7116 -1.7112 -1.7108 -1.7104 -1.7100 -1.7096 -1.7092 -1.7088 -1.7084 -1.7080 -1.7076 -1.7072 -1.7068 -1.7064 -1.7060 -1.7056 -1.7052 -1.7048 -1.7044 -1.7040 -1.7036 -1.7032 -1.7028 -1.7024 -1.7020 -1.7134 -1.7130 -1.7126 -1.7122 -1.7118 -1.7114 -1.7110 -1.7106 -1.7102 -1.7098 -1.7094 -1.7090 -1.7086 -1.7082 -1.7078 -1.7074 -1.7070 -1.7066 -1.7062 -1.7058 -1.7054 -1.7050 -1.7046 -1.7042 -1.7038 -1.7034 -1.7030 -1.7026 -1.7022 -1.7018 -1.7132 -1.7128 -1.7124 -1.7120 -1.7116 -1.7112 -1.7108 -1.7104 -1.7100 -1.7096 -1.7092 -1.7088 -1.7084 -1.7080 -1.7076 -1.7072 -1.7068 -1.7064 -1.7060 -1.7056 -1.7052 -1.7048 -1.7044 -1.7040 -1.7036 -1.7032 -1.7028 -1.7024 -1.7020 -1.7016 -1.7130 -1.7126 -1.7122 -1.7118 -1.7114 -1.7110 -1.7106 -1.7102 -1.7098 -1.7094 -1.7090 -1.7086 -1.7082 -1.7078 -1.7074 -1.7070 -1.7066 -1.7062 -1.7058 -1.7054 -1.7050 -1.7046 -1.7042 -1.7038 -1.7034 -1.7030 -1.7026 -1.7022 -1.7018 -1.7014
surf(x,y,psi_19)
Now, I want to plot the function in 0<=x<=1 and 2<=y<=3
Please help
Thanks

Accepted Answer

KSSV
KSSV on 7 Nov 2022
Edited: KSSV on 7 Nov 2022
You pick your x,y to the given range.
x = linspace(0,1) ;
y = linspace(2,3) ;
[X,Y] = meshgrid(x,y);
psi_19 = (2*X) + Y - (X*Y) - 2 ;
surf(X,Y,psi_19)

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!