Question

use MATLAB and PLZ comment the code so that it is easy to understand

Implement the following series of sinusoidal signals in MATLAB: 1 sin(kt) where N 30 k=1 x(t) k 1 Write a MATLAB script which

0 0
Add a comment Improve this question Transcribed image text
Answer #1

(a) MATLAB CODE:

clc
clear all
close all

T = 2*pi;
t = 0:0.01:3*T;
x = sin(t);

plot(t,x)
xlabel('t')
xlim([0 3*T])
title('sin(t)')
grid on

OUTPUT:

sin(t) 0.8 0.6 0.4 0.2 0 -0.2 -0.4 0.6 -0.8 10 6 8 12 14 16 18(b) MATLAB CODE:

clc
clear all
close all

T = 2*pi;   % Fundemental period
t = 0:0.01:3*T;
x = sin(t) + (1/2)*sin(2*t); % x(t) when N = 2

plot(t,x)
xlabel('t')
xlim([0 3*T])
title('sin(t) + (1/2)*sin(2t)')
grid on

OUTPUT:

sin(t)(1/2)sin(2t) 1.5 0.5 0 0.5 -1 1.5 6 8 10 12 14 16 18

(c) MATLAB CODE:

clc
clear all
close all

T = 2*pi;   % Fundemental period
t = 0:0.01:3*T;

N = 1:30;
for i = 1:30;
   
    x = 0;
   for k = 1:N(i);
       x1 = (1./k).*sin(k.*t);
       x = x + x1;
      
       plot(t,x)
       xlabel('t')
      
       pause(2) % Stops execution for 2 seconds
   end
end

Add a comment
Know the answer?
Add Answer to:
use MATLAB and PLZ comment the code so that it is easy to understand Implement the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x...

    Q: please solve using matlab code withe comment 1.      Write the Matlab code to generate: x = cos(w1*t) + cos(w2*t); where, w1=7; w2=23; t = [0:0.005:2] 2.   Plot the signal using sub plot a.   in time domain b.   in frequency domain 3)   Sample the signal under different sampling conditions: a.      Ts<1/2fm b.      Ts=1/2fm c.       Ts>1/2fm 4).      Multiple plot: the signal sampled under sampling condition and the signal x a.      in time domain b.      in frequency domain c.       Label and Title...

  • PLZ shows you Matlab Code X(t) 2 2 46 1. compute the Fourier Series coefficients, ck...

    PLZ shows you Matlab Code X(t) 2 2 46 1. compute the Fourier Series coefficients, ck for the signal x(t) 2. plot magnitude of c and the phase of ck in separate plots (use subplot command) plot the Fourier Series coefficients for the square wave signal: ck(12/9) sinc(2"k/3)

  • ** INCLUDE MATLAB CODE ** Use MATLAB® to implement and plot the discrete fourier transform (DFT)...

    ** INCLUDE MATLAB CODE ** Use MATLAB® to implement and plot the discrete fourier transform (DFT) for the following waveform: x(t) = 5 + 2cos(2*pi*t – pi/2) + 3cos(2*pi*4*t)

  • (B) Implement Matlab code for each part as described below: i) Define the following signal in tim...

    Using MATLAB, Please read carefully, EXPLAIN CODE AND ANSWERS, DISCUSS RESULTS, I NEED EVERY PART (B) Implement Matlab code for each part as described below: i) Define the following signal in time and plot it where Ai 10, A2-3, fi-10 Hz, f2-40 Hz. part of the DFT, and discuss the results. zero. Do this carefully for both positive and negative frequencies. Call this signal G (f). ii) Compute the DFT S(f) of s (t) using the fft() function. Plot the...

  • Please answer the question and include matlab code and plots. Thank You Problem 1: The operation...

    Please answer the question and include matlab code and plots. Thank You Problem 1: The operation of signal dilation or decimation or down-sampling is defined by y(n) = x(nM) in which the sequence x(n) is down-sampled by an integer factor M. Explore Matlab’s downsample command to implement the above equation. Now generate x(n) = sin(0.125πn), for −50 ≤ n ≤ 50. Decimate x(n) by a factor of 4 to generate y(n). Plot both x(n) and y(n) using subplot and comment...

  • please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab:...

    please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...

  • Implement MATLAB code that calculates sin(x) using the following formula, and measure the absolute error from...

    Implement MATLAB code that calculates sin(x) using the following formula, and measure the absolute error from the MATLAB provided function. The Taylor's formula is given as follows: sin(x) = 0+12 + 0x² + 5123 + 0.x4 + ... 23 25 27 -3! + 5- 7 + ... Plot both (1) the approximated value, and (2) absolute error. The following example uses x = 3 * pi, and k = 50. You may choose your own x, and k values. Approximation:...

  • USE matlab please show code and leave comments. Thank you bb)for for the following signal show...

    USE matlab please show code and leave comments. Thank you bb)for for the following signal show how the series approaches the signal by increasing no. of terms w(t) 3n 2t 2n n cvcn n1.5, 9,13, n=3, 7, 11, 15, 2 2 7/4 sin nt dt =0 Show the result for 1,3, 6,20, 50, 120 terms Do you see any unexpected behavior in the result, explain( in any)

  • Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440;...

    Create a file named “toneA.m” with the following MATLAB code: clear all Fs=5000; Ts=1/Fs; t=[0:Ts:0.4]; F_A=440; %Frequency of note A is 440 Hz A=sin(2*pi*F_A*t); sound(A,Fs); Type toneA at the command line and then answer the following: (a) What is the time duration of A? (b) How many elements are there in A? (c) Modify toneA.m by changing “Fs=5000” to “Fs=10000”. Can you hear any difference? (d) Create a file named “tone.m” with the following MATLAB code: function x = tone(frequency,...

  • Can you write hand solutions and matlab code please? Q3) There is a square wave with...

    Can you write hand solutions and matlab code please? Q3) There is a square wave with the period of T=21. The amplitude is 3 between 0 and it The amplitude is 0 between 1 and 2 T. 2 3 4 5 a) Find the Fourier series coefficients of this square wave. a = x()ật Il x(t)cos(kt)dt bx = ( x(t)sin(kt)dt b) Using Matlab, plot the truncated Fourier series; (1) For k 0 to 10 (II) For k 0 to 1000...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT