help with probably one of the simplest problem...

Hi guys, I'm very new to Matlab... I've been using mathematica but my professor insisted that I should start using matlab... This code is about plotting the magnitude of 'gamma'. The domain of the horizontal axis is frequency, and I want it such that I could modify the sampling rate easily.
When I run the code, I get an error saying that the matrix doesn't match...

[code]
%universal constants
c = 345;
rho = 407 / c;
L = 1;

%frequency here
N = 5; % number of sections
dx = L / N;
T = (L / c) / N;
Fs = 1 / T; % sample rate required
npoints = 2^12;
f = linspace(0, Fs, npoints); % frequency vector

%equations here
w = 2*pi*f;
s = i*w;
rc = 0.00375;
rrad = c / w;
Ac = pi*(rc^2);
Arad = 2*pi*(rrad^2);
z0 = rho*c/Ac;
Yrad = (Arad/(s*rc*rho))+(Arad/(rho*c));
Zrad = 1 / Yrad;

gamma = (Zrad-z0)/(Zrad+z0);
plot(abs(gamma))
[/code]

And one more question, what is the code for defining the plot range of the Y-axis?

Have a great day guys =)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories