Plotting a magnitude response calculated by hand
27 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have calculated a magnitude response and phase response by hand as:
| H(w) | = | 0.5*[1+cos(w)] |
<H(w) = -w
And now I want to plot the magnitude response, but it does not look like I would expect it to (a lowpass filter). The plot is shown below.
I'm pretty sure my equations are right. So how do it get it to actually look like a magnitude response in the plot? ![halp.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/198346/halp.png)
![halp.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/198346/halp.png)
0 Kommentare
Antworten (1)
Astha Singh
am 12 Dez. 2018
Hello Stine,
To obtain the expected plot of the magnitude of the frequency response, you would need to plot the same in the frequency (here, 'w') range: (-π,π).
You can set the X-Tick labels in the plot accordingly.
A sample code is attached
w=-linspace(-pi , pi, 100);
mag = abs( 0.5*(1+cos(w)) );
plot(w,mag)
xticks(-pi: pi/2 : pi)
xticklabels({'-\pi', '-\pi/2','0','\pi/2','\pi'})
This leads to the expected low pass frequency response curve for the above system.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Signal Generation and Preprocessing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!