How to achieve the unification of addition and multiplication in state space models

5 views (last 30 days)
for example,sys=1/(s+1),I have a test,sys1+sys1=2s/(s^2+2s+1),but 2*sys=2/(s+1),so which I should choose? and now I want to calculate 1/2 *sys,maybe a fraction 1.5,hope to get your help :)
  1 Comment
kang
kang on 30 Nov 2024
I am sorry that I make a mistake that sys1+sys2=(2s+2)/(s^2+2s+1).it seems that it's same as 2*sys,but its (sys1+sys2).a is 2*2,it means that (2s+2)/(s^2+2s+1) is different from 2/s+1 with system.A .

Sign in to comment.

Accepted Answer

Mr. Pavl M.
Mr. Pavl M. on 30 Nov 2024
Edited: Mr. Pavl M. on 30 Nov 2024
clc
clear all
close all
%Algebraic help:
%sys = 1/(s+1)
%2s/(s^2+2*s+1) = 2*s/(s+1)(s+1) = s/(s+1)(s+1) + s/(s+1)s+1)
%(2*s+2)/(s^2+2*s+1) = 2*(s+1)/(s+1)(s+1) = 2/(s+1)
%You need to show that (2*s+2)/(s^2+2*s+1) = 2*sys
num1 = 1;
den1 = [1,2];
sys1 = tf(num1,den1)
sys1 = 1 ----- s + 2 Continuous-time transfer function.
sys1 = tf(num1, den1)
sys1 = 1 ----- s + 2 Continuous-time transfer function.
sys2 = 2*sys1
sys2 = 2 ----- s + 2 Continuous-time transfer function.
sys2 = tf(2*num1,den1)
sys2 = 2 ----- s + 2 Continuous-time transfer function.
num3 = [2 2]
num3 = 1×2
2 2
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
den3 = [1 2 1]
den3 = 1×3
1 2 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
sys3 = tf(num3,den3)
sys3 = 2 s + 2 ------------- s^2 + 2 s + 1 Continuous-time transfer function.
minreal(sys3)
ans = 2 ----- s + 1 Continuous-time transfer function.
s = tf( 's' )
s = s Continuous-time transfer function.
sys4 = 2/(s+1)
sys4 = 2 ----- s + 1 Continuous-time transfer function.
sys5 = (2*s+2)/(s^2+2*s+1)
sys5 = 2 s + 2 ------------- s^2 + 2 s + 1 Continuous-time transfer function.
sys4.numerator
ans = 1x1 cell array
{[0 2]}
sys4.denominator
ans = 1x1 cell array
{[1 1]}
sys6 = minreal(sys4)
sys6 = 2 ----- s + 1 Continuous-time transfer function.
if norm(sys4 - sys6,inf) == 0
display('Transfer functions are equal')
else
tf(zpk(sys4)) - tf(zpk(sys6))
sys4/sys6
disp('They differ')
end
Transfer functions are equal
%if all(cell2mat(sys6.numerator) == cell2mat(sys4.numerator)) && all(cell2mat(sys6.denominator) == cellmat(sys4.denominator))
% display('OK')
%end
%Constructed by
%https://independent.academia.edu/PMazniker
%+380990535261, https://join.skype.com/invite/oXnJhbgys7oW
%https://diag.net/u/u6r3ondjie0w0l8138bafm095b
%https://github.com/goodengineer
%https://orcid.org/0000-0001-8184-8166
%https://willwork781147312.wordpress.com/portfolio/cp/
%https://www.youtube.com/channel/UCC__7jMOAHak0MVkUFtmO-w
%https://nanohub.org/members/130066
%https://pangian.com/user/hiretoserve/
%https://substack.com/profile/191772642-paul-m
%kindly accept my the answer-solution.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!