Line 1: Line 1:
 
 
== Part 1 ==
 
== Part 1 ==
  
 
Seems like a lot of people used the cosine function in hw1 so thats the one i'll use now.
 
Seems like a lot of people used the cosine function in hw1 so thats the one i'll use now.
  
 +
<pre>
 +
%{
 +
  Jeremiah Wise
 +
  9/11/08
 +
  HW #2 Part A 1
 +
 
 +
  This program plots and displays a cosine wave
 +
  in DT. The first plot is periodic and the second
 +
  is not.
 +
%}
 +
 +
 +
%Periodic signal
 +
 +
delta = pi/100;
 +
n = [0 : delta : 6 * pi];
 +
 +
plot(n, cos(n), '.');
 +
title('Periodic cosine function');
 +
xlabel('n');
 +
ylabel('cos(n)');
 +
 +
%Non-Periodic Signal
 +
figure(2)
 +
 +
delta = 1;
 +
n = [0 : delta : 6 * pi];
 +
 +
plot(n, cos(n), '.');
 +
title('Non-Periodic cosine function');
 +
xlabel('n');
 +
ylabel('cos(n)');
 +
 +
</pre>
  
 
[[Image:PeriodicSignal_ECE301Fall2008mboutin.jpg]]
 
[[Image:PeriodicSignal_ECE301Fall2008mboutin.jpg]]
Line 11: Line 44:
 
== Part 2 ==
 
== Part 2 ==
  
 +
<pre>
 +
%{
 +
  Jeremiah Wise
 +
  9/12/08
 +
  HW #2 Part A 2
 +
 
 +
  This program plots and displays a function that has been made periodic
 +
  by adding together shifted copies of that function.
 +
%}
 +
 +
delta = 1 / 1000;
 +
n    = [0 : delta : 10 * pi];
 +
 +
x = exp(-n / 10) .* sin(2 * n);
 +
 +
for k = 1 : 1 : 2
 +
    n = [n  (n + k*10*pi)];
 +
    x = [x x];
 +
end
 +
 +
plot(n,x);
 +
title('Shifted Copies of a Non-Periodic Signal');
 +
xlabel('n');
 +
ylabel('x[n]');
 +
</pre>
  
 
[[Image:partA2_ECE301Fall2008mboutin.jpg]]
 
[[Image:partA2_ECE301Fall2008mboutin.jpg]]

Revision as of 09:48, 12 September 2008

Part 1

Seems like a lot of people used the cosine function in hw1 so thats the one i'll use now.

%{
  Jeremiah Wise
  9/11/08
  HW #2 Part A 1
  
  This program plots and displays a cosine wave
  in DT. The first plot is periodic and the second
  is not.
%}


%Periodic signal

delta = pi/100;
n = [0 : delta : 6 * pi];

plot(n, cos(n), '.');
title('Periodic cosine function');
xlabel('n');
ylabel('cos(n)');

%Non-Periodic Signal
figure(2)

delta = 1;
n = [0 : delta : 6 * pi];

plot(n, cos(n), '.');
title('Non-Periodic cosine function');
xlabel('n');
ylabel('cos(n)');

PeriodicSignal ECE301Fall2008mboutin.jpg Non-PeriodicSignal ECE301Fall2008mboutin.jpg


Part 2

%{
  Jeremiah Wise
  9/12/08
  HW #2 Part A 2
  
  This program plots and displays a function that has been made periodic 
  by adding together shifted copies of that function.
%}

delta = 1 / 1000;
n     = [0 : delta : 10 * pi];

x = exp(-n / 10) .* sin(2 * n);

for k = 1 : 1 : 2
    n = [n  (n + k*10*pi)];
    x = [x x];
end

plot(n,x);
title('Shifted Copies of a Non-Periodic Signal');
xlabel('n');
ylabel('x[n]');

PartA2 ECE301Fall2008mboutin.jpg

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood