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

 Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 21 de Dic. de 2013

6 votos

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

5 comentarios

Nguyen Trong Nhan
Nguyen Trong Nhan el 21 de Dic. de 2013
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 el 21 de Dic. de 2013
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 el 21 de Dic. de 2013
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 el 11 de En. de 2017
Thank you.
Giuseppe Degan Di Dieco
Giuseppe Degan Di Dieco el 9 de Oct. de 2021
Thank you mate.

Iniciar sesión para comentar.

Más respuestas (1)

Shreedhar Sarda
Shreedhar Sarda el 15 de En. de 2022

0 votos

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

Categorías

Productos

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by