(wrote the first draft (could be final))
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Homework 2_ECE301Fall2008mboutin|<< Back to Homework 2]]
 +
 +
Homework 2 Ben Horst:  [[HW2-A Ben Horst _ECE301Fall2008mboutin| A]]  ::  [[HW2-B Ben Horst _ECE301Fall2008mboutin| B]]  ::  [[HW2-C Ben Horst _ECE301Fall2008mboutin| C]]  ::  [[HW2-D Ben Horst _ECE301Fall2008mboutin| D]]  ::  [[HW2-E Ben Horst _ECE301Fall2008mboutin| E]]
 +
----
 +
  
 
Here is the original code given:
 
Here is the original code given:
Line 15: Line 20:
 
</pre>
 
</pre>
  
[[Image:hw2_B1_bhorst_ECE301Fall2008mboutin.png|frame|The original code output]]
+
[[Image:hw2_B1_bhorst_ECE301Fall2008mboutin.png|frame|center|The original code output]]
  
  
Line 43: Line 48:
  
 
Note how even though the output from the original code (the blue stars) resembled a sinusoidal function, it was not nearly the correct information to display from the signal.
 
Note how even though the output from the original code (the blue stars) resembled a sinusoidal function, it was not nearly the correct information to display from the signal.
[[Image:hw2_B2_bhorst_ECE301Fall2008mboutin.png|frame|The adjusted code output (red line is the higher resolution signal)]]
+
[[Image:hw2_B2_bhorst_ECE301Fall2008mboutin.png|frame|center|The adjusted code output (red line is the higher resolution signal)]]

Latest revision as of 07:00, 10 September 2008

<< Back to Homework 2

Homework 2 Ben Horst: A  :: B  :: C  :: D  :: E



Here is the original code given:

F0 =13;

T0 =1/F0;

Ts = 0.07;

t  = 0:Ts:13*T0;

x = real(exp(j*(2*pi*F0*t-pi/2)));

plot(t,x)
The original code output


The problem is that the cycle of signal is 1/13 which is approximately .077 which means that a timestep of .07 for sampling is not going to yield accurate results. If we decrease the timestep, the resolution of the result will improve dramatically.


The adjusted code is shown here:

F0 =13;

T0 =1/F0;

Ts = 0.07;

t  = 0:Ts:13*T0;

x = real(exp(j*(2*pi*F0*t-pi/2)));

%------------Added section------------
Ts2 = Ts/1000;
t2 = 0:Ts2:13*T0;
x2 = real(exp(j*(2*pi*F0*t2-pi/2)));
%-----------/Added section------------

plot(t2,x2,'r',t,x,'b*')  %tweaked to show both

Note how even though the output from the original code (the blue stars) resembled a sinusoidal function, it was not nearly the correct information to display from the signal.

The adjusted code output (red line is the higher resolution signal)

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett