필터 지우기
필터 지우기

Creating a simple plot

조회 수: 2 (최근 30일)
Vaultec
Vaultec 2014년 10월 1일
편집: Rick Rosson 2014년 10월 1일
Im trying to plot y=x*e^(-x^2) where the range of x is from -3,3
Ive tried running
x = -3:3; y = x*exp(-x.^2); plot (x, y) however i keep getting the error Inner matrix dimensions must agree. Not quite sure what that means

채택된 답변

Rick Rosson
Rick Rosson 2014년 10월 1일
편집: Rick Rosson 2014년 10월 1일
Use .* instead of * here:
y = x.*exp(-x.^2);
Also, you will want higher resolution:
x = -3:0.01:3;

추가 답변 (2개)

Michael Haderlein
Michael Haderlein 2014년 10월 1일
You need element-wise multiplication:
x = -3:3;
y = x.*exp(-x.^2); %<-- here, I added the point
plot (x, y)

Vaultec
Vaultec 2014년 10월 1일
ok thanks worked out perfectly

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by