Convert a function into a matrix

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)

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

Can I have the matrix of h(t) without substituting the value of t?
Without substituting t, h(t) is a symbolic function rather than a matrix.
I can't understand.. I can convert it into a matrix? because each term represent a term for me so I want it to be in a matrix form in order to see what are the terms
how to convert this symbolic function into a matrix?
Can you explain what you want to store in the matrix? What is tge tern you are referring to? Show some examples.
The H(s) function in the code is supposed to be two terms, the state of charge (SOC) and voltage drop (Vrc), but I dont know which terms they are, so I want it to be converted in to a matrix 2x1 in order to identify which terms
????????????????????

Sign in to comment.

Products

Release

R2019b

Asked:

on 24 Jun 2022

Commented:

on 24 Jun 2022

Community Treasure Hunt

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

Start Hunting!