How I can plot the magnitude and phase response oh the function (2024)

341 Ansichten (letzte 30 Tage)

Ältere Kommentare anzeigen

Helda am 19 Okt. 2013

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function

  • Verknüpfen

    Direkter Link zu dieser Frage

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function

Beantwortet: Abood Abusafea am 2 Feb. 2022

i want do that for this function y=(4*sin(50*t)/(6*t)

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Antworten (7)

sixwwwwww am 19 Okt. 2013

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_100247

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_100247

In MATLAB Online öffnen

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 Kommentare

6 ältere Kommentare anzeigen6 ältere Kommentare ausblenden

Helda am 20 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175343

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175343

thanx alot :)

Helda am 20 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175344

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175344

oh ,,,, but i want to plot the response oh this function ,,, i think we will convert the function to frequency domain ,,, plz help me

sixwwwwww am 20 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175364

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_175364

In MATLAB Online öffnen

You can do so by the following way:

syms t y s

y = 4 * sin(50 * t) / (6 * t);

figure, ezplot(abs(y), [1, 100]), title('Amplitude of transfer function'), ylabel('Amplitude')

figure, ezplot(angle(y), [1, 100]), title('Phase of transfer function'), ylabel('Phase')

response_function = laplace(y, t, s);

figure, ezplot(abs(response_function)), title('Amplitude of response function'), ylabel('Amplitude')

figure, ezplot(angle(response_function)), title('Phase of response function'), ylabel('Phase')

Good luck!

Helda am 24 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176271

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176271

hi i want to ask u some question :) what the meaning of this code ?? fs=100; t=0:1/fs:5; x=4*cos(2*pi*10*t+pi/6); X=fft(x); n=length(x); c=(-1*fs)/2:fs/n:fs/2-fs/n; subplot(4, 1, 1),plot(t,x); subplot(4, 1 ,2),plot(c,fftshift(abs(X))); subplot(4, 1, 3),plot(c,phase(X)); subplot(4,1 ,4),plot(c,real(X)); ...... why did use this statement (( n=length(x);))?? i hope u can help me !!

sixwwwwww am 24 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176283

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176283

In MATLAB Online öffnen

Here is the explanation of this code:

fs = 100; % It is sampling frequency

t=0:1/fs:5; % It is time series used to generate signal x

x = 4 * cos(2 * pi * 10 * t + pi / 6); % x is function of t

X = fft(x); % This statement computes Fourier transform of x

n = length(x); % length(x) gives the array length of signal x

c = (-1 * fs) / 2:fs / n:fs / 2 - fs / n; % It generates the frequency series to plot X in frequency domain

subplot(4, 1, 1),plot(t,x); % This subplot shows the signal x vs. time series t

subplot(4, 1 ,2),plot(c,fftshift(abs(X))); % This subplot shows the Fourier spectrum of x with zero frequency component shifted to center

subplot(4, 1, 3),plot(c,phase(X)); % This subplot shows the phase distribution of X (Fourier transform of x)

subplot(4,1 ,4),plot(c,real(X)); % This subplot shows the real component of X spectrum

and the statement

n=length(x);

is used to make the length of frequency series equal to length of time series to plot Fourier transform of signal x correctly

David am 25 Okt. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176311

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_176311

Wow, way to make her put in a little effort of her own.

Helda am 28 Nov. 2013

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_182476

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_182476

plz help me :/ for filter with a transfer function of H=(0.1667*s^3-0.5*s^2+0.5*s+0.1667)/(s^3-0.3333*s) what is the filter order ? what the filter type ? (FIR,IIR) why? plot the frequency response of the filter ? find the filter gain by matlab ?

Engr Muhammad Amir Shahzad am 11 Apr. 2020

Direkter Link zu diesem Kommentar

https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_825906

  • Verknüpfen

    Direkter Link zu diesem Kommentar

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#comment_825906

@sixwwww. Why you used *fftshift* in plotting magnitude of signal?

Melden Sie sich an, um zu kommentieren.

David am 20 Okt. 2013

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_100317

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_100317

In MATLAB Online öffnen

"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 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Afshin Aghayan am 24 Jul. 2017

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_275291

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_275291

Bearbeitet: Afshin Aghayan am 2 Aug. 2017

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 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Ammar Uddin am 12 Feb. 2018

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_304767

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_304767

How can I plot the magnitude and phase spectrum of this DTFT.

x(n) = a*n u(n)

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

wyeen chow am 10 Nov. 2019

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_400755

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_400755

Hi, can i know how to plot a magnitude and phase spectrum for full wave rectifier? I had calculated manually?

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

SRIKRISHNAN SRIRAMAN am 10 Nov. 2020

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_539650

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_539650

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 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Abood Abusafea am 2 Feb. 2022

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_887020

  • Verknüpfen

    Direkter Link zu dieser Antwort

    https://de.mathworks.com/matlabcentral/answers/90780-how-i-can-plot-the-magnitude-and-phase-response-oh-the-function#answer_887020

14s/(s+13)

0 Kommentare

-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Melden Sie sich an, um diese Frage zu beantworten.

Siehe auch

Kategorien

Signal ProcessingSignal Processing ToolboxSignal Generation and PreprocessingSmoothing and Denoising

Mehr zu Smoothing and Denoising finden Sie in Help Center und File Exchange

Tags

  • digital image processing

Community Treasure Hunt

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

Start Hunting!

Es ist ein Fehler aufgetreten

Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.


Translated by How I can plot the magnitude and phase response oh the function (17)

How I can plot the magnitude and phase response oh the function (18)

Website auswählen

Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .

Sie können auch eine Website aus der folgenden Liste auswählen:

Amerika

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europa

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asien-Pazifik

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Kontakt zu Ihrer lokalen Niederlassung

How I can plot the magnitude and phase response oh the function (2024)
Top Articles
Latest Posts
Recommended Articles
Article information

Author: Velia Krajcik

Last Updated:

Views: 5253

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.