필터 지우기
필터 지우기

How to plot with if statement

조회 수: 2 (최근 30일)
Steve
Steve 2020년 12월 2일
편집: Steve 2020년 12월 3일
How to plot with if statement :
I'm trying to plot this equation with if statement, but it didn't work
n=[0:20]
e(n+1)=sin(n+1)
a=2
Trial(n+1)=e(n+1)+a
k=1
for f=Trial(n+1)-k
if f<0,
alfa(n+1)=a
b=2
x=alfa(n+1)+b
else,
d=1
alfa(n+1)=a+d
b=2
c=4
x=alfa(n+1)+b+c
f=n+1
And how to plot (x vs alfa) ?

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 12월 2일
I suggest going through MATLAB Onramp.
  • Ch 9 - plotting
  • Ch 13 - if statements, for loops

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by