Plotting equations using fzero

조회 수: 13 (최근 30일)
Sarah Allrozamo
Sarah Allrozamo 2021년 5월 19일
댓글: Sarah Allrozamo 2021년 5월 21일
How do I plot the follwing equations using the fzero funtion?
e^x
8x-4
Also how do you attach the title e^x and 8x-4 on it.
Then add the functions x^4 and x^2 on the same graph using the ezplot function.
I tried to to it a couple of times and had no luck.

채택된 답변

David Hill
David Hill 2021년 5월 19일
fzero is not for plotting. It finds the zero crossing at an initial guess. This will get you started. Look at legend() and title() commands.
y1=@(x)exp(x);
y2=@(x)8*x-4;
x=-2:.01:5;
a=fzero(@(x)y1(x)-y2(x),.5);%finds intersection of the curves near .5
b=fzero(@(x)y1(x)-y2(x),3);%finds intersection of the curves near 3
plot(x,y1(x),x,y2(x),a,y1(a),'*',b,y1(b),'*');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by