I am trying to use subplot, but got an error message I do not know how to correct.
(Also, since only the value of w varies, is there a more compact way to write this code rather than saying "cos(stuff*t") ten times in a row? Thanks.)
my current code is
clear all
clc
t = 0:0.001:40;
% there are 10 values of w to show, so make a 2x5 grid to show them all via
% subplot (2,5, blank)
x1=cos(pi/16*t);
x2=cos(pi/8*t);
x3=cos(pi/4*t);
x4=cos(pi/2*t);
x5=cos(pi*t);
x6=cos(15*pi/8*t);
x7=cos(2*pi*t);
x8=cos(5*pi/2*t);
x9=cos(3*pi*t);
x10=cos(4*pi*t);
subplot(2,5,x1), plot(t,x,1), subplot(2,5,x2), plot(t,x,2), subplot(2,5,x3),
plot(t,x,3), subplot(2,5,x4), plot(t,x,4), subplot(2,5,x5), plot(t,x,5),
subplot(2,5,x6), plot(t,x,6), subplot(2,5,x7), plot(t,x,7), subplot(2,5,x8),
plot(t,x,8), subplot(2,5,x9), plot(t,x,9), subplot(2,5,x10), plot(t,x,10);
%Error using subplot (line 330);
%Illegal plot number;
%Error in (line 19);
%subplot(2,5,x1), plot(t,x,1);