Hi, I am trying to plot two functions on the same graph that I have defined as
f = @(x) cos(x)-sin(x)
g = @(x) sqrt(2).*((cos(x+pi/4))
I have the bounds defined as well, and was trying to plot them by
ezplot(f,[xlow xhigh ylow yhigh]); grid on; hold on;
and then the same line using g in place of f
I have plotted multiple functions on the same plot using this code before, but cannot figure out why it won't work in this situation
Thanks

 채택된 답변

dpb
dpb 2016년 9월 27일

0 개 추천

Work out some trig identities but note that
>> x=[-6*pi:12*pi/100:6*pi]; % define a commensurate range of x consistent w/ ezplot
>> max(g(x)-f(x))
ans =
1.2212e-15
>>
The two functions are idential to within a bit or two of precision. You did plot 'em both, they're just indistinguishable from each other.

추가 답변 (0개)

카테고리

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

태그

질문:

2016년 9월 26일

편집:

dpb
2016년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by