Starting from:
$35

$29

Lab 1: Introduction to Python3 Solution


    1. Write a Python3 function mysinplotthat takes in 3 arguments: frequency fin Hz, sampling frequency fsin Hz, and number of cycles n T1,and plots exactly nperiods of a sine func ion of frequency f Hz, sampled at fs Hz. In the report, briefly describe your logic, and give a few example plo s.

    2. Let x(t) = sin(2p f t), t 2 [ T, T], T > 0 and zero elsewhere. Consider the signal y(t) = x( ), t 2 [ T1, T1], T1 > 0 and zero elsewhere. In order to simulate and com-pute the amplitude spectrum of x, we will sample the signal y at fs Hz in order to obtain a sampled sequence denoted by yd, and apply Discrete Fourier transform on yd (using fft). Write a function myctftthat takes in T, fs, and plots the amplitude

spectrum of y. The x-axis must be scaled appropriately to show frequency in Hz.

    (a) Show a few example plots with different values for the input parameters.

    (b) Given f = 10Hz, T = 1sec, analytically compute the Fourier transform of x, and using appropriate values of T1 and fs try to obtain the amplitude spectrum as close as possible to the analytical result using your code, with proper justification.

    (c) What happens when we set T = T1, and why?











































1

More products