Convert a function into a matrix

4 views (last 30 days)
Hend Mostafa
Hend Mostafa on 24 Jun 2022
Commented: Chunru on 24 Jun 2022
I want (h(t)) to be in form of matrix, how to do it?
Parameters= {'R0','R1','C1','Qr','bo','b1','SOC','Vrc','Voc'};
R0=0.000605797;
Qr=147964.8608;
R1=0.000856205;
C1=0.049823238;
% X=[SOC;Vrc];
A=[0 0;0 -1/R1*C1];
B=[1/Qr;1/C1];
C=[1 1];
D= R0;
% u=Il;
sys= ss(A,B,C,D);
tfsys = tf(sys);
n = tfsys.Numerator;
d = tfsys.Denominator;
syms s t
H(s) = poly2sym(n,s) / poly2sym(d,s)
H = vpa(H, 5);
h(t) = ilaplace(H)
h = vpa(h, 5)
figure
fplot(h)
grid
axis([0 0.1 0 20])

Answers (1)

Chunru
Chunru on 24 Jun 2022
Parameters= {'R0','R1','C1','Qr','bo','b1','SOC','Vrc','Voc'};
R0=0.000605797;
Qr=147964.8608;
R1=0.000856205;
C1=0.049823238;
% X=[SOC;Vrc];
A=[0 0;0 -1/R1*C1];
B=[1/Qr;1/C1];
C=[1 1];
D= R0;
% u=Il;
sys= ss(A,B,C,D);
tfsys = tf(sys);
n = tfsys.Numerator;
d = tfsys.Denominator;
syms s t
H(s) = poly2sym(n,s) / poly2sym(d,s)
H(s) = 
H = vpa(H, 5);
h(t) = ilaplace(H)
h(t) = 
% h = vpa(h, 5)
figure
fplot(h)
grid
axis([0 0.1 0 20])
t1=linspace(0, 0.1, 21)
t1 = 1×21
0 0.0050 0.0100 0.0150 0.0200 0.0250 0.0300 0.0350 0.0400 0.0450 0.0500 0.0550 0.0600 0.0650 0.0700 0.0750 0.0800 0.0850 0.0900 0.0950 0.1000
h1 = double(h(t1))
h1 = 1×21
Inf 15.0041 11.2163 8.3847 6.2680 4.6857 3.5028 2.6185 1.9575 1.4633 1.0939 0.8177 0.6113 0.4570 0.3416 0.2554 0.1909 0.1427 0.1067 0.0798 0.0596
  7 Comments
Chunru
Chunru on 24 Jun 2022
????????????????????

Sign in to comment.

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!