How to plot this implicit function?

조회 수: 10 (최근 30일)
xiao dage
xiao dage 2015년 6월 24일
답변: Torsten 2015년 6월 25일
x and y satisfy this implicit function:
10000^x*cos(x*pi/2)+10000^y*cos(y*pi/2)=0 (This implicit function cannot be transferred into the form as y=f(x) )
And z =(1000.^x).*sin(x*pi/2)*(10e-6)+(1000.^y).*sin(y*pi/2)*(10e-6);
Now how to plot (x,z)? I just use ezplot to plot (x,y), but I cannot pick up the concrete values of (x,y).

채택된 답변

Torsten
Torsten 2015년 6월 24일
Given x, calculate y from the relation
10000^x*cos(x*pi/2)+10000^y*cos(y*pi/2)=0
using MATLAB's fzero.
Then insert x and y in the relation
z =(1000.^x).*sin(x*pi/2)*(10e-6)+(1000.^y).*sin(y*pi/2)*(10e-6);
to calculate z.
Best wishes
Torsten.
  댓글 수: 1
xiao dage
xiao dage 2015년 6월 25일
편집: xiao dage 2015년 6월 25일
Thank you for your answer!
The above graph is produced by
ezplot('10000^x*cos(x*pi/2)+10000^y*cos(y*pi/2)=0',[0,4])
It can be seen that for one x, two or more values of y had been obtained is we expand the scope of x.
And with
y=@(a)fzero(@(y) 10000^x*cos(x*pi/2)+10000^y*cos(y*pi/2),1);
y1=y(0.1);
I can only calculate one y for one x, for example y1=y(0.1). So how to insert x and y in the relation
z =(1000.^x).*sin(x*pi/2)*(10e-6)+(1000.^y).*sin(y*pi/2)*(10e-6);
to calculate z if I want to plot (x,z) in the scope of (0,2).

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

추가 답변 (1개)

Torsten
Torsten 2015년 6월 25일
xstart=0;
xend=2;
nx=10;
for i=1:nx+1
x0=xstart+(i-1)/nx*(xend-xstart);
x(i)=x0;
y0=fzero(@(y) 10000^x0*cos(x0*pi/2)+10000^y*cos(y*pi/2),1);
z(i)=(1000^x0)*sin(x0*pi/2)*(10e-6)+(1000^y0)*sin(y0*pi/2)*(10e-6);
end
plot(x,z)
Best wishes
Torsten.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by