• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Assistance trying to put textbook equations into MATLAB

Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
hi guys

Im on a music tec course at uni and im playing with some DSP.

Ive been able to successfuly create some simple code for low and high pass filters where you just input a center frequency but now im trying to further that by adding a q variable also.

The equations for the coefficents are highlighted in red.

Ino the rest of the code works as it should because when i just change the coeficents values depending on the filter it works. But when i change them to these it plays no sound and the variable y which is my output doesnt contain any samples.

In a nut shell the equations in the text book what am i doing wrong to translate them into my code?

thanks guys hope im making sense

On a side note before you think it im not asking you to do any work for me, this is further reading.



 

Fourstaff

Moderator
Staff member
Joined
Nov 29, 2009
Messages
10,024 (1.91/day)
Location
Home
System Name Orange! // ItchyHands
Processor 3570K // 10400F
Motherboard ASRock z77 Extreme4 // TUF Gaming B460M-Plus
Cooling Stock // Stock
Memory 2x4Gb 1600Mhz CL9 Corsair XMS3 // 2x8Gb 3200 Mhz XPG D41
Video Card(s) Sapphire Nitro+ RX 570 // Asus TUF RTX 2070
Storage Samsung 840 250Gb // SX8200 480GB
Display(s) LG 22EA53VQ // Philips 275M QHD
Case NZXT Phantom 410 Black/Orange // Tecware Forge M
Power Supply Corsair CXM500w // CM MWE 600w
b0=k/(k^2*Q+K+Q) or b0=k/(k^2*(Q+K+Q)) not quite sure what you want.
similar for the rest, you need to add a bracket to group the denominators together otherwise you will end up doing the wrong calculation.

Dont ask me about making time pass stuff, I am struggling with the Fourier Transforms of the time series for now.
 
Joined
Sep 1, 2010
Messages
7,023 (1.41/day)
It seems that your brackets are all wrong.

It should be something like this:

b0=K/(K*K*Q+K+Q);
b1=0;
b2=-K/(K*K*Q+K+Q);
a1=(2*Q*K*K-2*Q)/(K*K*Q+K+Q);
a2=(K*K*Q-K+Q)/(K*K*Q+K+Q);

However I dunno the purpose of these formulas .. so
 
Joined
May 27, 2008
Messages
3,628 (0.62/day)
System Name Ultra 64
Processor NEC VR4300 (MIPS R4300i)
Motherboard proprietary design
Cooling Fanless aircooled
Memory 4.5MB 250 MHz RDRAM
Video Card(s) 62.5 MHz Reality Coprocessor
Storage 32 - 512 Mbit ROM Cartridge
Display(s) 720x576
Case Clear Blue Funtastic
Audio Device(s) 16-bit CD quality
Power Supply proprietary design
Mouse N64 mouse for use with N64DD
Keyboard N64 keyboard for use with N64DD
Thank you very much.

Basicly i failed high school maths. So the basic maths that every one expects you to know some of it i struggle with. Like in the equations from the text book, where to put the brackets, or which variables you times by each other. So what i was after was how to write out the equations in the text book.

Which you both showed and now my band-pass filter works. I can sweep through center frequencies and controll the bandwidth basicly a notch filter.

The purpose of the forumlas are that they calculate coeficents to put into a transfer function (or the nice easy filter function in matlab) so that you can create various forms of filters and controll their parameters.
 
Top