How to solve the transfer function with summation

9 views (last 30 days)
syms f i
f= 10e6;
g(1) = 0.09;
g(2) = -0.012;
g(3) = 0.012;
g(4)= -0.012;
g(5) = 0.022;
d(1) = 100; d(2) = 130; d(3) = 160; d(4) = 190; d(5) = 300;
K= 1;
a0 = 0;
a1 = 1.65e-9;
Vp= 1.53e8;
F = 50;
H(f) = symsum(g(1i).exp-(a0+a1F)^d(1i).exp-(0.000000205*d(1i)*j),1i,1,5);

Answers (1)

Walter Roberson
Walter Roberson on 2 Oct 2019
Edited: Walter Roberson on 2 Oct 2019
MATLAB uses .* or * for multiplication, not period
MATLAB does not have implicit multiplication. MATLAB will not know that a1F is intended to mean a1*F
Your equation does not involve F , it involves f . MATLAB is case sensitive.
MATLAB uses exp(-expression) for , not exp-expression
The second parameter of symsum needs to be a symbolic variable name, but you have used 1i instead.
You are trying to use 1i as an index, but complex numbers can never be used as indices.
When you use symsum(), you can never use the variable of summation as a matrix index.
What you need to do is vectorize:
H(f) = sum( g .* exp(-(a0+a1*f.^k).*d) .* exp(-1j*2*pi*f.*d./Vp) )

Community Treasure Hunt

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

Start Hunting!