필터 지우기
필터 지우기

How to plot the function f(x)=x^3 - 4x^2 +1 for x∈[0,25]

조회 수: 18 (최근 30일)
Potatopao
Potatopao 2015년 4월 14일
편집: pfb 2015년 4월 14일
x= 0:0.01:25. For y=x^3 - 4x^2 +1 your plot command will be variant of plot(x,y).

채택된 답변

pfb
pfb 2015년 4월 14일
You almost got it. Since x is a vector, you should use elementwise operators. not x^2 (what's the square of a vector?) but x.^2.
  댓글 수: 1
pfb
pfb 2015년 4월 14일
편집: pfb 2015년 4월 14일
also, you should write the multiplication operator (*) explicitly
x= 0:0.01:25
y=x.^3 - 4*x.^2 +1;
plot(x,y);

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by