필터 지우기
필터 지우기

how can we display our real roots or points

조회 수: 1 (최근 30일)
adriana resendez
adriana resendez 2015년 3월 3일
댓글: Star Strider 2015년 3월 3일
>> f = @(x) x^3-3*x-1;
>> fplot(f, [-10 10]); grid on;
  댓글 수: 2
Andrew Newell
Andrew Newell 2015년 3월 3일
Do you want to find the roots or just change the display so you can see the crossings?
adriana resendez
adriana resendez 2015년 3월 3일
both

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

채택된 답변

Star Strider
Star Strider 2015년 3월 3일
편집: Star Strider 2015년 3월 3일
Use the roots function:
xr = roots([1 0 -3 -1]);
They all happen to be real. This gives the x-values, so if you want to plot them, the y vector is:
yr = zeros(size(xr));
  댓글 수: 4
adriana resendez
adriana resendez 2015년 3월 3일
on the m file?
Star Strider
Star Strider 2015년 3월 3일
I changed ‘r’ to ‘xr’ when I created ‘yr’ and forgot to change it in ‘yr’. The code is consistent now.
With a couple tweaks, you can plot everything easily:
f = @(x) x^3-3*x-1;
xr = roots([1 0 -3 -1]);
yr = zeros(size(xr));
figure(1)
fplot(f, [-10 10], '-r')
hold on
plot(xr, yr, 'bp')
hold off
grid on

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by