Solve for NUMBER 3 ONLY. I posted the answers for 1 and 2 because it...

50.1K

Verified Solution

Question

Accounting

Solve for NUMBER 3 ONLY. I posted the answers for 1 and 2 because it is needed to solve for 3

imageimageimageimageimageimageimageimageimageimage

1. Sum of Complex Exponentials ( 30 points) M - EA - Ajeiwit i=1 Consider a signal defined as xs(t) = As you see, xs(t) is obtained as the superposition of M complex exponentials, where A; and W; respectively denote the complex amplitude and angular frequency of the i-th complex exponential. In this part, you will write a MATLAB program in the form of a MATLAB function) that computes the values of xs(t). Your function should look like function [x] = SUMCS(t,A,omega) where t: 1x N vector that contains the time instants over which xs(t) is computed. A: 1 x M complex-valued vector. The i-th element is Ai. omega: 1 x M vector. The i-th element is wi. While writing your function, make use of the exp function of MATLAB. Use a single for loop over the index i. Do not use any for loop over the time points. Doing so will result in significant loss of grade. Your program does not need to show any error message if a wrong value is given for any of the inputs (for instance, if A is of size 1 x 5 but omega is of size 1 x 7). Simply assume that you will always run your function with correct inputs. Also, throughout all your programs, in order to avoid programming bugs, reserve the letter j for V-1, i.e., do not use it as the counter of any for loop or so. Include your code to your report. Hint: Given A (or omega), you can use the length command of MATLAB to determine its length. Type help length in MATLAB to learn how it works. After writing your function, take t=[0:0.001:1) and n = mod(your MSU ID, 41). Then, create a random 1 x n complex amplitude array for A. The real and imaginary parts of the complex amplitude should be between 0 and 3. Also create another 1 x n real frequency array for omega. The created frequency array should be between 0 and 1. You can create these random arrays using rand function of MATLAB. Type help rand to learn how to use rand function. (Note that MATLAB's random number generator, and the other random number generators used in other computer programs and languages, are pseudo-random generators. That means, they do not produce completely random numbers.) Using your function, compute xs (which is complex valued). Then, extract the real and imaginary parts of xs. Plot the real and imaginary parts (versus t) separately. Also, extract the magnitude and phase of xs and plot them separately. In all your plots, put the labels and titles properly. Include your code and plots to your report. SUMCS.m : function (xs] = SUMCS(t,A,omega) M = length(A); % Number exponentials to be added w = omega; % for convinience sum = zeros(1,length(t)); % preallocate space for fast execution of program j=1i; % define j as sqrt(-1) for i = 1:M % for loop for addition of all M exponentials sum = sum + A(i)*exp(j*w(i)*t); end XS = sum; % return the computed signal values end % Note: Name of this file must be same as function name "SUMCS.m". % Otherwise error will occur testfile.m: MSU_ID = 208119011; % Enter your MSU ID Here t=0:0.001:1; % time axis n = mod(MSU_ID, 41); % size n A = 3*(rand(1,n) + i*rand(1,n)); % complex random number b/w (0,3) omega = pi*rand(1,n); % real random number b/w (0,pi) [xs] = SUMCS(t,A,omega); % call SUMCS function to create xs(t) subplot(211) % 1st plot in 2x1 slots of figure plot(t,real(xs), Linewidth',3); % plot real part title('Real part of x_s(t)'); xlabel('t ightarrow'); subplot(212) plot(t,imag(xs), 'Linewidth,3); % plot imaginary part title('Imaginary part ofx_s(t)'); xlabel('t ightarrow'); figure % new figure subplot(211) plot(t,abs(xs), Linewidth',3); % plot magnitude title('Magnitude of x_s(t)'); xlabel('t ightarrow'); subplot(212) plot(t,angle(xs)'Linewidth',3); % plot phase title('Phase of x_s(t)'); xlabel('t ightarrow'); plots: Magnitude of x (t) 30 25 20 1 O 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Phase of x (t) 2.5 2 1.5 1 0.5 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Real part of x-(t) 20 10 0 -10 -20 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Imaginary part of x-(t) 30 25 20 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 2. Periodic Signal Synthesis with Fourier Series (20 points) Consider a signal x(t) which is periodic with T such that x(t) = x(t + T) for all t. Then the Fourier series representation of x(t) is x(t) = Xxel 2* k=-00 where the coefficients Xx are computed according to 1 Xx X(t)e-11'dt 21 kr FL Note that the Fourier series decomposes the signal as a weighted superposition of complex sinusoidal signals ej2mkt/T, where the weights are given by Xk- For perfect reconstruction of the signal x(t), an infinite number of complex sinusoids are required. But in practice, we can only sum a finite number of sinusoids. In this respect, consider the signal f(t), which is defined as f(t) = Xkejurken k=-K where K is a positive integer. Note that if K = co we would have f(t) = x(t). When K is finite, f(t) is only an approximation to x(t). Now suppose within t [-23), x(t) is given as 1-412 if-

Answer & Explanation Solved by verified expert
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students