matlab3 - Matlab Project 3 EB 228-045 j gh The purposes of...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Matlab Project 3 EB 228-045 j gh 4/21/06 The purposes of these team Matlab project assignments are to introduce the student to the use of Matlab, to use Matlab as a tool to learn the theory presented in lecture and to analyze more complicated systems than pencil and paper conveniently allow, and to introduce the student to team project work. The BB 228 class is to form into two or three person teams for the Matlab assignments; teams can be greater than three, but the larger teams will require the prior approval of the instructor. For the submittal of each assignment, each team will submit one report, with each team member providing one thoughtful, reflective paragraph discussing what they have learned. All students are to read Chapter 21 in their text. Matlab is available on computers in the Digital Senior Project Lab (20-118) which should be open from 8:00am to 6:00pm Monday through Friday, and 9:00am to 1:00pm on Saturdays. The BB 368 lab (20-113) also has a copy of Matlab installed on each of its machines. Access to the BB 368 lab will be limited to periods outside scheduled lab times. Request access to the lab at the Senior Project window — your name should be on a list fiom the BB 228 class list. The team members are to learn the use of the Matlab through the online documentation and/or the Matlab supplied tutorial and/or through the use of the text material in Chapter 21. Each team is to enter the following Matlab m-file code and execute it. The exponential form is used for the calculation of the Fourier series. The engineer who coded the m-file below made an error. The error resulted from the fact that the periodic function of time exhibited half-wave symmetry, and the code for the indexing of the coefficients does not take this into account. Correct the code, and display the correct figures. Note the similarity in the magnitude and phase displays for either version of the code, but the serious mistake in the signal output resulting from the use of the uncorrected code. Let this observation be a warning for relying on using the output of a computer without anticipating the correct answer or at least checking it, as good engineers do. Also, note the Gibbs phenomena in the reconstructed signal for nmax=30; you can increase the value of nmax to fiirther explore this phenomena. The report is to consist of a commented version of your corrected m-file code, the magnitude and phase displays for both nmax = 5 and 30 for the corrected version of the code, and the individual paragraph from each of the team members discussing what they have learned from the experience. The report is due Friday May 5. %script: fscalcm %example of a Fourier series m-file. This is based upon Example 21.34 in your text. The signal x(t) has a period % T = 20 ms, and the exponential form of the Fourier series is given by X[0]=0 and X[k]=j/(k*pi), k~=0. The code %plots the two-sided magnitude and phase spectrum and its one-period reconstruction to 5 harmonics %and 30 harmonics. nmax=5; n=[l :nmax]; j=Sqrt(-1); xk=—j./(n*pi); k=[-fliplr(n) 0 n]; Xk=[conj(fliplr(xk)) 0 xk]; subplot(3, 1, 1) stem(k,abs(Xk)) %title(‘magnitude of X[k]‘) xlabel('frequency index k') ylabel(lekll') subplot(3, 1,2) stem(k,angle(Xk)) %title('phase of X[k]') %xlabel('frequency index k') ylabel(’phase (rad)') T=0.2; t—=0:0.001:T; xp=0; for m=1:length(k); xp=xp+Xk(m)*exp(i*2*pi*k(m)*t/T); end . xpr=real(xp); subplot(3,],3) p10t(t,XPr) title('partial sum of Fourier series xn(t)') xlabel(‘frequency in Hz') ylabel(‘xn(t)') If you wish to learn more about Matlab, as a challenge (not required), replace the for loop with vector operations. ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern