Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Undefined variable or function 'b'
Replies: 1   Last Post: May 10, 2013 1:28 PM

 Messages: [ Previous | Next ]
 Jacob Posts: 1 Registered: 5/10/13
Undefined variable or function 'b'
Posted: May 10, 2013 1:20 PM

I don't understand why it's not reading from the script when I enter these commands

figure(1);
subplot(2,1,1), zplane(b),title('zplance of FIR'), ylabel('Imaginary part'), xlabel('Real Part')
subplot(2,1,2), plot(w,abs(fr)),title('Magnitude of Frequency Response'), ylabel('Amplitude'), xlabel('w(pi)')

it always says undefined variable 'b'
Ive made sure its headed to the right folder and everything.

Here is my code:

FIR_Input1c ='C:\Users\niel0512\Desktop\DSF\FIR_Input1c';
[X, FS, NBITS] = wavread(FIR_Input1c);

FIR_Input1 = 'C:\Users\niel0512\Desktop\DSF\FIR_Input1';
[O, FS, NBITS] = wavread(FIR_Input1);

z1 = exp(.3*pi*1i);
z2 = exp(-.3*pi*1i);
z3 = exp(.5*pi*1i);
z4 = exp(-.5*pi*1i);
z5 = exp(.8*pi*1i);
z6 = exp(-.8*pi*1i);
z7 = -1;

b=conv([1, -z1],[1, -z2]);
b=conv(b,[1,-z3]);
b=conv(b,[1,-z4]);
b=conv(b,[1,-z5]);
b=conv(b,[1,-z6]);
b=conv(b,[1,-z7]);

b = b./8;
a = 1;

[fr,w]=freqz(b,1,-pi:pi/1000:pi);

y= filter(b,a,X);
y= real(y);

Date Subject Author
5/10/13 Jacob
5/10/13 dpb