## 30 Reputation

10 years, 65 days

## Solve equation with matrix arguments...

I have an equation to solve

where  is scalar,  is vector,  is vector,  is a matrix. I need to solve this equation for  but S1 is matrix sow can I tell Maple that S1 is matrix? If we solve the equation with matrix we need to use matrices inverse. If we have to divide by matrix we use the product of the inverse of this matrix.

## Get rhs of equation in matrix...

Maple

I have matrix:

`m1 := Matrix([[x[0,0]=1,x[0,1]=1,x[0,2]=0,x[0,3]=0,x[0,4]=0,x[0,5]=0],[x[1,0]=0,x[1,1]=0,x[1,2]=1,x[1,3]=1,x[1,4]=0,x[1,5]=0],[x[2,0]=0,x[2,1]=0,x[2,2]=0,x[2,3]=0,x[2,4]=1,x[2,5]=1]]);`

How to get values on the rhs of x without using for loops and create a matrix using these values?.

Results should be:

`m2 := Matrix([[1,1,0,0,0],[0,0,1,1,0,0],[0,0,0,0,1,1]]);`

## Solve ode with time and input vector fro...

Maple

I solve ode for simply DC motor system:

```J:= 0.01;b:=0.1;K:= 0.01;R:=1;L:=1;
eq1:=J*diff(theta(t),t,t)+b*diff(theta(t),t)=K*i(t):
eq2:=L*diff(i(t),t)+R*i(t)=V-K*diff(theta(t),t):

ICs:= theta(0)=0, D(theta)(0) = 0, D(theta)(0) = 0, i(0) = 0:
sol:=dsolve({eq1,eq2,ICs},numeric,parameters=[V],output=listprocedure):
sol(parameters=[10]):
ode_x1:=sol[2];
ode_x1:=rhs(ode_x1);
ode_x2:=sol[3];
ode_x2:=rhs(ode_x2);

p1:=plot([ode_x1(t),ode_x2(t)],t=0..50,gridlines=true):
plots[display](array([p1]));```

I have time wektor and input wektor V in csv file. How to change this code to simulate

ode solution ode_x1 and ode_x2 with data from file? Now I set V as

`sol(parameters=[10])`

and t in

`plot([ode_x1(t),ode_x2(t)],t=0..50,gridlines=true)`

Best

## How to find parameters that satisfy the ...

Maple 2015

Hello,

I have the follownig set of inequality:

{0 < p[1, 2], p[1, 1] < 2*p[2, 2]+(3/2)*p[1, 2], p[1, 2]^2/p[2, 2] < p[1, 1], (2/3)*p[1, 2] < p[2, 2]}

Now I need to find value of p11,p12,p22 that satisfy the above inequality. Is there any easy way to find

parameters p11, p12, p22 in maple?

Best

## Piecewise function - How plot function ...

Maple 2015

Hi

I have the following piecewise function in Maple:

`sigmaP:=piecewise(u < -1,-1,u >1,1,u);`

Now we can plot this function:

`plot(sigmaP,u=-5..5,size=[1200,300],gridlines,discont=[showremovable]);`

Next, I define a new piecewise  function as

`sigmaF:=u->piecewise(u < -1,-1,u >1,1,u);`

and I use this function in

```Fun:=proc(x1,x2,u1,u2)
2*x1*(1+x2)*sigmaF(u1)+(1+x2^2)*sigmaF(u2);
end proc:```

Now I need to find a minimum of this function so I use the following code

`GlobalOptimization:-GlobalSolve(Fun,x1,x2,u1,u2);`

where

```x1:=-5..5;
x2:=-10..100;
u1:=-1..1;
u2:=-1..1;
```

And I have the problem with plot function Fun. How to plot function Fun???

Best

 1 2 3 Page 1 of 3
﻿