星期三, 9月 30, 2009

matlab 100101


% program file lab100101.m
clear all;
a=10;
ts = 0.001;
t1 = -0.5:ts:0.5;
x1 = a*cos(2*pi*5*t1);

ts2 = 0.05;
t2 = -0.5:ts2:0.5;
x2 = a*cos(2*pi*5*t2);

ts3 = 0.01;
t3 = -0.5:ts3:0.5;
x3 = a*cos(2*pi*5*t3);

subplot(311);
plot(t1,x1);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(312);
stem(t2,x2);
xlabel('t,(s)');
ylabel('x(t)');
grid;

subplot(313);
stem(t3,x3);
xlabel('t,(s)');
ylabel('x(t)');
grid;

沒有留言: