How to create symbol function matrix in matlab?

I need to solve a linear differential equations, such as diff(Y) = AY, Y(0) = Y0. Y \in R^n; So I need to generate a column of symbol function. I used the following code
clc;clear;
n = 7;
syms t V;
A = sym('A', [n 1]);
U = symfun(A,[t]);
However, as the result shows, the size of U is 1 by 1. I don't know what is wrong and how I can make it work.
I will appreciate your help a lot. Best,

 채택된 답변

Star Strider
Star Strider 2014년 12월 8일

0 개 추천

The solution to your differential equation (assuming a constant ‘A’) is:
Y = expm(A*t)
You will likely have significant problems with it in the Symbolic Math Toolbox. I would deal with it only numerically.

추가 답변 (1개)

Andrew Newell
Andrew Newell 2014년 12월 8일

0 개 추천

To get an n x n matrix, use
A = sym('A',n);

댓글 수: 1

I change the way to generate A but the resulting U is still shown to be 1 by 1. It seems it doesn't make a difference. Thanks!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

질문:

2014년 12월 8일

댓글:

2014년 12월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by