필터 지우기
필터 지우기

Plotting Error (Very Simple Code)

조회 수: 1 (최근 30일)
onsagerian
onsagerian 2018년 2월 3일
편집: onsagerian 2018년 2월 3일
As part of practice of plotting, I made a very simple code, but it has an error. Would you check the code and explain on the problem so that I can make an correction?
x=1.0:0.2:2.0; y=2/x; plot(x,y)
Error using / Matrix dimensions must agree.
Error in Untitled6 (line 2) y=2/x;

채택된 답변

Walter Roberson
Walter Roberson 2018년 2월 3일
y = 2./x;
The operation A/B is like A * inv(B) where * is algebraic matrix multiplication. You want element-by-element division, which is the ./ operator
  댓글 수: 1
onsagerian
onsagerian 2018년 2월 3일
편집: onsagerian 2018년 2월 3일
It works! Thank you so much.

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

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