I am trying to plot a function of the form
y=f(x,y)
That is y as a function of x. Any help?
Thanks

답변 (1개)

madhan ravi
madhan ravi 2018년 11월 9일
편집: madhan ravi 2018년 11월 9일

0 개 추천

fimplicit(@(x,y) x.^2 - y.^2 - 1)
fplot(@(x) sin(x))
syms x y
f(x, y) = sin(x + y)*sin(x*y);
ezplot(f)

댓글 수: 8

T S Singh
T S Singh 2018년 11월 9일
@madhan I am using 2015 version so 'fimplicit' is not available. Can you please suggest me any other way.
madhan ravi
madhan ravi 2018년 11월 9일
편집: madhan ravi 2018년 11월 9일
Use ezplot , if it doesn’t work either upload your function here
om = 4.0264e+05;
sd=.3*om;
k3=0.01;
ld=0.085;
c0=@(a)-(om^2+(3/4)*k3*a^2)*sd^2+(om^2+(3/4)*k3*a^2)*(om^2+(3/4)*k3*a^2+ld^2+2*y*ld+(3/2)*k3*a^2);
c1=@(a)2*(om^2+(3/4)*k3*a^2)*(2*y+ld)+2*y*(ld^2+2*y*ld+(3/2)*k3*a^2);
c2=@(a)2*(om^2+(3/4)*k3*a^2)+(3/2)*k3*a^2+ld^2+4*y^2+6*y*ld;
c3=2*(2*y+ld);
b1=@(dm)-2*dm*om*(y+ld);
b2=@(a,dm)(om^2+(3/4)*k3*a^2)+(3/2)*k3*a^2+ld^2+2*y*ld-(dm*om)^2;
eq=@(a,dm)sqrt((b1(dm)^2+b2(a,dm)^2)/(((dm*om)^4-c2(a)*(dm*om)^2+c0(a))^2+(c3*(dm*om)^3-c1(a)*dm*om)^2))-a;
I want to plot 'a vs dm' for dm=[0,3]
Thanks
madhan ravi
madhan ravi 2018년 11월 9일
a and dm are arguments not equations be specific with clear explanation
eq=@(a,dm)sqrt((b1(dm)^2+b2(a,dm)^2)/(((dm*om)^4-c2(a)*(dm*om)^2+c0(a))^2+(c3*(dm*om)^3-c1(a)*dm*om)^2));
a=eq(a,dm);
I suppose the last expression is of the form
y=f(x,y)
Thanks
madhan ravi
madhan ravi 2018년 11월 9일
편집: madhan ravi 2018년 11월 9일
om = 4.0264e+05;
sd=.3.*om;
k3=0.01;
ld=0.085;
c0=@(a)-(om.^2+(3./4).*k3.*a.^2).*sd.^2+(om.^2+(3./4).*k3.*a.^2).*(om.^2+(3./4).*k3.*a.^2+ld.^2+2.*y.*ld+(3./2).*k3.*a.^2);
c1=@(a)2.*(om.^2+(3./4).*k3.*a.^2).*(2.*y+ld)+2.*y.*(ld.^2+2.*y.*ld+(3./2).*k3.*a.^2);
c2=@(a)2.*(om.^2+(3./4).*k3.*a.^2)+(3./2).*k3.*a.^2+ld.^2+4.*y.^2+6.*y.*ld;
c3=2.*(2.*y+ld);
b1=@(dm)-2.*dm.*om.*(y+ld);
b2=@(a,dm)(om.^2+(3./4).*k3.*a.^2)+(3./2).*k3.*a.^2+ld.^2+2.*y.*ld-(dm.*om).^2;
eq=@(a,dm)sqrt((b1(dm).^2+b2(a,dm).^2)./(((dm.*om).^4-c2(a).*(dm.*om).^2+c0(a)).^2+(c3.*(dm.*om).^3-c1(a).*dm.*om).^2))-a;
a=linspace(1,3,1000); %fake data
m=linspace(0,3,1000);
plot(eq(a,m))
whats y value?
T S Singh
T S Singh 2018년 11월 9일
Can I take "dm" (say m=linspace(0,3,1000)) the independent variable and calculate the corresponding "a" (dependent variable) and plot??
madhan ravi
madhan ravi 2018년 11월 9일
yes

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

태그

질문:

2018년 11월 9일

댓글:

2018년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by