# How to create a mathematical expression which contains delays using Symbolic Math Toolbox?

4 Ansichten (letzte 30 Tage)
Hi everyone,
I'm trying to create a mathematical expression which contains some nonlinear terms like delays, interfaces etc., using symbolic math toolbox. An example of my code is as follows.
syms I1 I2 I3 I4 I5
terms = [I1.^2 I2-4 I1*I3-4 I4-8 I5]
theta = [1 2 1 1 5]'
Y = terms*theta
Here the term ''I3-4'' indicates the input I3 with a time delay of 4 seconds(I3(t-4)).I'm having the following issue
1. When I multiply terms and theta, it is giving me output as
Y =
Y = I1^2+2*(I2-4)+I1*(I3-4)+(I4-8)+5*I5
I understood that matlab is using BODMAS rule, but is there any correct way to create delay terms using Symbolic Math Toolbox. Can some one help me regarding this issue?
Thanks
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Raghunandan V am 4 Jun. 2019
Hi,
There is mistake in the coe :)
And the term I1*I3-4 is not the same you explained. Here it follows BODMAS rule.
I1*I3-4 = (I1*I3) - 4
NOT I1*(I3-4)
Regards,
Raghunandan V
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Sayyed Ahmad am 4 Jun. 2019
matlab multiplied and simplified your codes;
Y = I1^2+2*(I2-4)+I1*(I3-4)+(I4-8)+5*I5
Y = I1^2+2*I2-8+I1*I3-4+I4-8+5*I5
simpliefied to
Y= I1^2+I3.I1+ ... %highest order
2.I2+ ... % I2 to I5
I4+ ...
5.I5+ ...
-20 %constant
##### 2 KommentareKeine anzeigenKeine ausblenden
Raghunandan V am 4 Jun. 2019
I1*(I3-4) is not I1*I3-4 but I1*I3- 4*I1. Check the calc
Bearbeitet: Raja Vardhan Reddy Kothakapu am 4 Jun. 2019
yes, I understood that Matlab uses BODMAS rule. Some how I need to create this delay terms and pass them to the function handle , thats why I'm using I3-4 instead of I3(t-4). Maybe my question should be is there any correct way to create delay terms using symbolic math toolbax

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

R2018a

### Community Treasure Hunt

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

Start Hunting!

Translated by