# How I can plot the magnitude and phase response oh the function

조회 수: 881(최근 30일)
Helda 2013년 10월 19일
답변: Abood Abusafea 2022년 2월 2일
i want do that for this function y=(4*sin(50*t)/(6*t)

댓글을 달려면 로그인하십시오.

### 답변(7개)

sixwwwwww 2013년 10월 19일
Dear Helda, here is an example showing amplitude and phase plots of your defined function:
t = 1:100;
y = 4 * sin(50 * t) ./ (6 * t);
figure, plot(t, abs(y)), title('Amplitude plot')
figure, plot(t, angle(y)), title('Phase plot')
I hope it helps. Good luck!
##### 댓글 수: 8표시숨기기 이전 댓글 수: 7
@sixwwww. Why you used *fftshift* in plotting magnitude of signal?

댓글을 달려면 로그인하십시오.

David 2013년 10월 20일
"How I can plot the magnitude and phase response of the function
y=(4*sin(50*t)/(6*t)"
From what I've read, it seems you want the amplitude and phase of this function in the frequency domain. If this is the correct assumption to make, then you will need to make a lot more specifications. You will need to know your sampling rate, Fs, and either your time of observation or the number of points you have sampled. After you have figured these out, look into 'fft' function MATLAB provides.
An alternate route would be to use MATLAB's symbolic toolbox. You will want to look into how to create symbolic variables and symbolic equations as well as how to use the 'laplace', 'subs', and 'ezplot' functions. Good luck.
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

Afshin Aghayan 2017년 7월 24일
편집: Afshin Aghayan 2017년 8월 2일
look at the following Matlab function, it can calculate phase spectrum as well as amplitude spectrum with a perfect accuracy:
https://www.mathworks.com/matlabcentral/fileexchange/63965-amplitude-and-phase-spectra-of-a-signal--fourier-transform-
This program calculates amplitude and phase spectra of an input signal with acceptable accuracy especially in the calculation of phase spectrum.The code does three main jobs for calculation amplitude and phase spectra. First of all, it extends the input signal to infinity; because for calculation Fourier transform(FT) (fft function in Matlab), we consider our signal is periodic with an infinite wavelength, the code creates a super_signal by putting original signal next to itself until the length of super_signal is around 1000000 samples, why did I choose 1000000 samples? Actually, it is just based on try and error!! For most signals that I have tried, a supper signal with 1000000 samples has the best output.
Second, for calculating fft in Matlab you can choose different resolutions, the Mathwork document and help use NFFT=2^nextpow2(length(signal)), it definitely isn't enough for one that wants high accuracy output. Here, I choose the resolution of NFFT=100000 that works for most signals.
Third, the code filters result of FT by thresholding, it is very important step! For calculating phase spectrum, its result is very noisy because of floating rounding off error, it causes during calculation "arctan" even small rounding off error produces significant noise in the result of phase spectrum, for suppressing this kind of noise you can define a threshold value. It means if amplitude of specific frequency is less than predefined threshold value (you must define it) it put zero instead of it.
These three steps help to improve the result of amplitude and phase spectra significantly.
IF YOU USE THIS PROGRAM IN YOUR RESEARCH, PLEASE CITE THE FOLLOWING PAPER:
Afshin Aghayan, Priyank Jaiswal, and Hamid Reza Siahkoohi (2016). "Seismic denoising using the redundant lifting scheme." GEOPHYSICS, 81(3), V249-V260. https://doi.org/10.1190/geo2015-0601.1
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

Ammar Uddin 2018년 2월 12일
How can I plot the magnitude and phase spectrum of this DTFT.
x(n) = a*n u(n)
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

wyeen chow 2019년 11월 10일
Hi, can i know how to plot a magnitude and phase spectrum for full wave rectifier? I had calculated manually?
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

SRIKRISHNAN SRIRAMAN 2020년 11월 10일
Consider a sinusoidal signal with frequency components of 5Khz, 12Khz and 14Khz .
Find and plot the magnitude and phase spectra of the signal.
Plz suggest me how
to code this question
##### 댓글 수: 0표시숨기기 이전 댓글 수: -1

댓글을 달려면 로그인하십시오.

Abood Abusafea 2022년 2월 2일
14s/(s+13)

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!