필터 지우기
필터 지우기

why do i get the error: matrix dimensions must agree ??

조회 수: 2 (최근 30일)
María Jesús
María Jesús 2014년 9월 29일
편집: Mischa Kim 2014년 9월 29일
this is what I'm trying to plot
x=linspace(0,100,100);
a=5;
y=1/(abs(a*x)+1);
figure
plot(x,y)
how do I fix this error?

채택된 답변

Mischa Kim
Mischa Kim 2014년 9월 29일
편집: Mischa Kim 2014년 9월 29일
Maria, use
y = 1./(abs(a*x) + 1);
instead. Notice the dot right after the "1". This so-called elementwise division is necessary because x is a vector. See the documentation for more detail.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by