MATLAB: How to plot cos^2(2x) for x values between 0 and pi/2? specifically a figure with 25 points and a figure with 50

cosplot cos^2*(2*x)

figure(1); x=linspace(0, rad2deg(pi/2), 25); y=(cosd*(2.*x)).^2; plot(x, y)
this is my attempt for the first figure and I just get an error not having enough input points. Any help much appreciated.

Best Answer

figure(1);
x=linspace(0, (pi/2), 25);
y=(cos(2.*x)).^2;
plot(x, y)
figure(2);
x=linspace(0, (pi/2), 50);
y=(cos(2.*x)).^2;
plot(x, y)
Related Question