Plot3 and vector match issue

hello all,
I want to plot three functions (f1, f2, Fall) in different vector sizes (x,y) using plot3. Is there a way to do that?
if in case the only way is to have these vectors matched, how can match their sizes in matlab?
here is the code:
x = 1e3:10e6; \\ Freq of operation (big vector)
y = 3e-3:500e-3; \\resistance in the circuit
a=1e-6; \\ value that I change every time to get the optimized one
f1 = 5.*x ;
f2 = sqrt ((1/(a^2).*(x.^2)) + (5.*(Ron.^2));
Fall = f1 + f2;
figure (1); plot3(x,y,f1)
figure (2); plot3(x,y,f2);
figure (3); plot3(x,y,Fall);
thanks

 采纳的回答

N = 10000 ; % can be changed
% x = 1e3:10e6; % Freq of operation (big vector)
x = linspace(1e3,10e6,N) ;
% y = 3e-3:500e-3; %resistance in the circuit
y = linspace(3e-3,500e-3,N) ;
a=1e-6; % value that I change every time to get the optimized one
f1 = 5.*x ;
f2 = sqrt ((1/(a^2).*(x.^2)) + (5.*(Ron.^2)));
Fall = f1 + f2;
figure (1); plot3(x,y,f1)
figure (2); plot3(x,y,f2);
figure (3); plot3(x,y,Fall);

更多回答(1 个)

AbuYusuf
AbuYusuf 2017-2-25

0 个投票

Thank you so much! it works perfect. However, I was expecting to see 3D plot like a surface. I think plot3 does only line plot in 3D, right? I checked the surf function and tried to use it here but failed!
would you help me with this?

类别

Community Treasure Hunt

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

Start Hunting!

Translated by