{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab+Lab1++Solutions - -Period = plot tt4 xx4 Period.02...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Matlab Solutions: 4.2.1: Function: syn_sin function [xx,tt] = syn_sin(fk, Xk, fs, dur, tstart) %SYN_SIN Function to synthesize a sum of cosine waves % usage: % [xx,tt] = syn_sin(fk, Xk, fs, dur, tstart) % fk = vector of frequencies % (these could be negative or positive) % Xk = vector of complex amplitudes: Amp*eˆ(j*phase) % fs = the number of samples per second for the time axis % dur = total time duration of the signal % tstart = starting time (default is zero, if you make this input optional) % xx = vector of sinusoidal values % tt = vector of times, for the time axis % % Note: fk and Xk must be the same length. % Xk(1) corresponds to frequency fk(1), % Xk(2) corresponds to frequency fk(2), etc. n=length(fk); xx=0; tt = tstart:1/fs:dur; for k=1:n xx=xx+real(Xk(k)*exp(1i*2*pi*fk(k)*tt)); end Tesing: [xx4,tt4] = syn_sin([0,100,250], [10,14*exp(-j*pi/3),8*j], 10000, 0.1,0);
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

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

Unformatted text preview: %-Period = ? plot( tt4, xx4) Period : .02 Frequency: 50 5: Testing code: [xx4,tt4] = syn_sin([.5,.5,.5,.5], [2,2*exp(-j*pi*1.25),1,-j], 2000, 6,-.5); plot(tt4,xx4); 6: %--%--- multipath for Lab #2 %--c = 3e8; xv = 0:0.1:300; %-- vehicle locations in meters dt = 1500; %-- location of the transmitter dr = [100,900]; %-- location of the reflector G_r = 1; %-- gain of the reflector phi_r = pi; %-- phase of the reflector fo = 150e6; %-- in Hz lambda = c/fo % Rtv = abs(xv+j*dt); %-- range between xmtr and vehicle zr = dr*[1;j]; Rrefv = abs(xv-zr) + abs(j*dt-zr); %-- range between xmtr, refl and veh % delay_1 = Rtv/c; delay_2 = Rrefv/c; % X_1 = exp(-j*2*pi*fo*delay_1); X_2 = G_r*exp(j*phi_r)*exp(-j*2*pi*fo*delay_2); X_v = X_1 + X_2; % plot( xv, abs(X_v) ) shg...
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