Obtaining frequency response from transfer function

5 views (last 30 days)
Hi there,
I am trying to find the frequency response of this transfer function.
.
.
This is my effort which I believe to be correct of putting it into MATLAB. I do change the format a little to avoid divide by zero errors.
.
.
And here is my MATLAB code:
.
%%Modelling an amplifier
clc; clear; close all;
%%All important D factor (Distortion, also known in some parts as Distance)
Dist = 1;
fs = 44100; % Sampling frequency (Hz)
T = 1/fs; % Timestep
N = 1000; % Samples
f = -fs/2:fs/N:fs/2 - fs/N;
%%Circuit Parameters - Level 1
Rt = Dist * 100e3;
Rb = (1-Dist) * 100e3 + 4.7e3;
Cz = 1e-6;
Cc = 250e-12;
%%Substitutions - Level 2
a = Rt*Cc;
b = Rb*Cz;
c = Rb*Cc;
%%Substitutions - Level 3
x = a*b*c;
y = a*b + a*c + b*c;
z = a*c + b*c;
% Num and den of H(s)
sA = [c z x];
sB = [c y x];
% S domain frequency response
hS = freqs(sB,sA,f);
% Plot
semilogx(f, 20*log(abs(hS)));
xlabel('Frequency (Hz)');
ylabel('Magnitude Response (dB)');
title('H(s)');
end
.
This is the result I am going for.. (Dist == D)
.
.
The result I am getting is blatantly wrong.
Any help would be very appreciated!
Cheers

Answers (0)

Community Treasure Hunt

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

Start Hunting!