MATLAB: How to get MATLAB to plot this function? y = (P/x)*sin(x)+cos(x) where P = 3pi/2

functionplot

I have this code and it will not plot because the matrix dimensions don't agree.
P = (3*pi)/2 ;
x = linspace(0,2*pi,80);
y = (P/x)*sin(x)+cos(x);
figure
plot(x,y)

Best Answer

y = (P./x).*sin(x) + cos(x);