필터 지우기
필터 지우기

Matlab how can I make this inequality?

조회 수: 2 (최근 30일)
J. Nash
J. Nash 2017년 1월 19일
댓글: John BG 2017년 1월 21일
I have an exercise that requires me to plot a function of y=x^2 from 0<=x<pi/2 what would be the right approach for this?
  댓글 수: 6
Rena Berman
Rena Berman 2017년 1월 19일
편집: Rena Berman 2017년 1월 19일
(Answers dev) Restored question edits.
John BG
John BG 2017년 1월 21일
Mr Nash
please keep adding details with comments to your question and/or to the diverse answers of interest until you get what you need.
Then please choose and accept answer by clicking on the button Accept Answer.
Is it a limit that you want to calculate approaching (pi/2)^2?

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

채택된 답변

John BG
John BG 2017년 1월 19일
편집: John BG 2017년 1월 19일
There are different ways to display a graph as you are asking, one of the most basic ones being
1. define the base vector
step=0.01
x=[0:step:pi/2]
2. define the function
y=x.^2;
3. display
plot(x,y)
grid on
comments:
  • note the element wise operation implemented with the dot preceding the operator with '.^'
  • plot has many optional fields, check MATLAB help for plot
  • the smaller the step the higher the resolution
  • grid on is also optional
  • the figure window has a marker that can be used for quick checks
  • ; at the end of a command line prevents MATLAB command window showing execution
if you find these lines useful would you please mark my answer as Accepted Answer?
To any other reader, if you find this answer of any help please click on the thumbs-up vote link,
thanks in advance for time and attention
John BG

추가 답변 (1개)

Star Strider
Star Strider 2017년 1월 19일
You can use ezplot or fplot:
y = @(x) x.^2;
figure(1)
ezplot(y, [0, pi/2])
grid
figure(2)
fplot(y, [0, pi/2])
grid

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by