Matlab plotting and defining range

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 replies · 6K views
ketanco
Messages
15
Reaction score
0
how do you define x to be from minus pi to plus pi in matlab?

i tried:
x = -pi : piBut when i said plot (x,y)

Matlab says:

"Error using plot
Data must be numeric, datetime, duration or an array convertible to double"

(i already defined y interms of x, that function is ok)

so i culd not define x probably... how to do it?
 
on Phys.org
ketanco said:
how do you define x to be from minus pi to plus pi in matlab?

i tried:
x = -pi : piBut when i said plot (x,y)

Matlab says:

"Error using plot
Data must be numeric, datetime, duration or an array convertible to double"

(i already defined y interms of x, that function is ok)

so i culd not define x probably... how to do it?

Hi ketanco, welcome to MHB! ;)

Your x is fine, so I believe there is something wrong with your y.
Did you put a dot before each operator to allow for vector evaluation?
Did MatLab respond with a vector result for y?