Hello, I'm having problems with the "freqs" or "freqz" function
7 views (last 30 days)
Show older comments
I'm using a code that I found in MATLAB, to check if my code for another program is wrong. But this code that I found does not work either.
a = [1 0.4 1];
b = [0.2 0.3 1];
w = logspace(-1,1);
h = freqs(b,a,w);
mag = abs(h);
phase = angle(h);
phasedeg = phase*180/pi;
subplot(2,1,1)
loglog(w,mag)
grid on
xlabel('Frequency (rad/s)')
ylabel('Magnitude')
subplot(2,1,2)
semilogx(w,phasedeg)
grid on
xlabel('Frequency (rad/s)')
ylabel('Phase (degrees)')
This is the error I'm getting
Undefined function 'freqs' for input arguments of type 'double'.
Error in untitled4 (line 5)
h = freqs(b,a,w);
Do I need to activate the "freqs" function in MATLAB? I'm new to it, and don't have lots of experience generating code or using it. Thank you for any help.
0 Comments
Answers (1)
Walter Roberson
on 7 Mar 2023
You need to license and install the Signal Processing Toolbox.
If you purchased the MATLAB Student Suite then if I recall correctly that particular toolbox is included in the license; if you purchased MATLAB Student (not Suite) then it would not have been included by default.
2 Comments
Walter Roberson
on 9 Mar 2023
What shows up for you if you use the following commands?
ver('signal')
license('test', 'Signal_Toolbox')
Note: these exact names are important (though they are not case sensitive.) For example, testing 'signal' or 'signal_processing_toolbox' or 'signal toolbox' will fail.
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!