Function with multiple equations? Getting Error "Not enough input arguments."
10 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to create a function that uses the matlab function besselk(nu,z) (Modified Bessel function of the second kind K_0). It should be something like this: K_(r*(sqrt(s^2+s*b))), with s being a Laplace variable. There is somehting wrong in my code, I get the error Not enough input arguments (but i only want one input for this function):
function [K] = my_bessel(f)
D = 10^(-6);
t = 10^(-9);
c = sqrt(D/t);
r = 10*10^(-6);
b = (1/(c*t));
T = 10^(-5);
s = 2*(1i*pi*f) ;
x = r*(sqrt(s.^2+s*b)) ;
K = besselk(0,x) ;
end
To fix this I've tried:
s =@(f) 2*(1i*pi*f) ;
x =@(f) r*(sqrt(s.^2+s*b)) ;
K =@(f) besselk(0,x) ;
This doesn't give me any errors straight away but the function doesn't seem to work when I call for it.
Side note: the reason I'm doing this is K_0(r*(sqrt(s.^2+s*b))) is a transfer function that I'm trying to implement in FPGA. My goal is to do a lookup table approximation of the function because doing the classical bilinear transformation won't work unless the transfer function is a polynomial. I've tried approximating the function to a polynomial. I used taylor and Newton's binomial theorem to approximate it by hand, but only til the second degree. This was not accurate. Maybe someone may have tips for approximating exp(-x) and sqrt() functions on matlab without creating a mega long polynomial?
Anything can help.
Thanks
6 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!