I want to plot the graph y = 1/x. I do in command window :
syms x y
x=0,0.1,1;
y=1/x;
plot(x,y)
I appear the error like this:
??? Error using ==> mldivide Matrix dimensions must agree
could you please help me repair this error to plot the graph y = 1/x. thanks

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 21일

6 개 추천

x=0:0.1:1;
y=1./x;
plot(x,y)

댓글 수: 5

Nguyen Trong Nhan
Nguyen Trong Nhan 2013년 12월 21일
Could you explain me why I have to change y=1/x to y=1./x. What's the mean of " . " thanks
Azzi Abdelmalek
Azzi Abdelmalek 2013년 12월 21일
x is a vector, you can't divide 1 by a vector, what you need is [1/x(1) 1/x(2) ... 1/x(n)] ; this can be done in Matlab by 1./x
Nguyen Trong Nhan
Nguyen Trong Nhan 2013년 12월 21일
Oh, thanks you very much. Becuase i'm a student. I haven't known much about it yet. Hope you help me in others next questions.
Sandor Fogassy
Sandor Fogassy 2017년 1월 11일
Thank you.
Giuseppe Degan Di Dieco
Giuseppe Degan Di Dieco 2021년 10월 9일
Thank you mate.

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

추가 답변 (1개)

Shreedhar Sarda
Shreedhar Sarda 2022년 1월 15일

0 개 추천

Plot the function y=1/x in domain -2 to 2. At what point this function is not continuous?

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

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

Start Hunting!

Translated by