I am trying to plot y=x^2sin(x), where x is from 0 to 2pi. I have defined x using the linspace command, but matlab does not agree with the (x.^2) part. Is there a concept I am missing?

13 views (last 30 days)
>> x=linspace(0,2*pi);
>> y=(x.^2)*sin(x);
Error using *
Inner matrix dimensions must agree.

Accepted Answer

Ernesto Martinez
Ernesto Martinez on 22 Apr 2019
y= (x.^2).*sin(x.^-1);

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!