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

 采纳的回答

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

5 个评论

Could you explain me why I have to change y=1/x to y=1./x. What's the mean of " . " thanks
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
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.

请先登录,再进行评论。

更多回答(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