How to add a number of transfer function

Dear All
I am trying to get transfer function of a circuit, my question is how to sum Rn in the for loop rather than using this command
R=Rn(1)+Rn(2)+Rn(3)+Rn(4)+Rn(5)+Rn(6)+Rn(7)+Rn(8)+Rn(9)+Rn(N)
thanks in advance
close all
clear all
clc
format short
s=tf('s')
RL=100e3 % leakge resistor
%define the parameters
L=50e-9 % inductance the unit should be converted from nano
Ri=1.883e-3
T=1.67 % tau
C=1130 % capacitor
N=10 % the number of RC
Zm=(Ri+L*s+1/C*s) % resitor, inductance and capacitor connected in series
for n=1:N
Rn(n)=(2*T*C*s)/(n^2*pi^2*1)
Cn=C/2
end
R=Rn(1)+Rn(2)+Rn(3)+Rn(4)+Rn(5)+Rn(6)+Rn(7)+Rn(8)+Rn(9)+Rn(N)
Zs=R/(1+R*Cn*s)

 Accepted Answer

Salim, you could simply do
...
R = 0
for n = 1:N
R = R + (2*T*C*s)/(n^2*pi^2*1)
Cn = C/2
end
Zs = R/(1+R*Cn*s)

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!