MATLAB Matlab Sysmolic maths differential equation

AI Thread Summary
MATLAB allows the representation of unknown functions, such as x(t), in equations using symbolic math. Users can define derivatives of these functions, as demonstrated with the command "y = sym('y(t)')". The differentiation of y can be expressed in terms of its derivatives, as shown in the example where f is defined as a combination of second and first derivatives of y. The output can be formatted for clarity using the "pretty" function, making it easier to interpret the symbolic representation. This capability is useful for solving differential equations symbolically in MATLAB.
SpartanG345
Messages
69
Reaction score
1
Hi

is it possible to represent unknown functions eg x(t) in MATLAB equations ?

eg have f = x''
diff(f) = x'

or have a derivative represented via differential eg dx/dt
 
Physics news on Phys.org
finally found it out for those who want to know

>> y = sym('y(t)')

y =

y(t)


>> f = diff(y,2) + diff(y,1) + y

f =

diff(y(t),$(t,2))+diff(y(t),t)+y(t)


>> pretty(f)

/ 2 \
|d | /d \
|--- y(t)| + |-- y(t)| + y(t)
| 2 | \dt /
\dt /
>>
 

Similar threads

Replies
2
Views
3K
Replies
3
Views
5K
Replies
8
Views
2K
Replies
5
Views
3K
Replies
4
Views
1K
Replies
1
Views
2K
Replies
4
Views
3K
Replies
4
Views
1K
Back
Top