0
$\begingroup$

I am using Octave but I think it applies to MatLab too, so I'm tagging this MatLab since there isnt a Octave tag

When I do

x=linspace(-5,5,25)
y=1/x

I get

error: operator /: nonconformant arguments (op1 is 1x1, op2 is 1x25)

Or

x=linspace(-5,5,25)
y=x^2

I get

error: for A^b, A must be square

How can I then plot the graphs of each?

1 Answers 1

1

Try:

x=linspace(-5,5,25)
y = 1./x
plot(x,y)

x=linspace(-5,5,25)
y=x.^2
figure
plot(x,y)