How can i plot function 2^x ??

조회 수: 89 (최근 30일)
Rolando Gutierrez
Rolando Gutierrez 2014년 6월 27일
편집: madhan ravi 2018년 10월 14일
Sorry im a beginner, but if I got
X=0:0.1:3
Y=2^x
Plot(X,Y)
Why wont matlab plot it? And how do I solve it? Thanks

채택된 답변

Ken Atwell
Ken Atwell 2014년 6월 27일
You've almost got it. Two things to fix:
  1. MATLAB is a case-sensitive language (that upper and lower case matters), so you must use upper-case "X" consistently, and "plot" is all lower case.
  2. The "^" (raise to the power) operator is for square matrices. To computer a per-element raise to the power, use ".^" instead.
X=0:0.1:3
Y=2.^X
plot(X,Y)
  댓글 수: 1
madhan ravi
madhan ravi 2018년 10월 14일
편집: madhan ravi 2018년 10월 14일
Accepted by madhan ravi since the OP didn’t accept the answer

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

추가 답변 (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