How can I define an array of symbolic functions?

121 views (last 30 days)
I want to make an array a1(t) a2(t)... an(t).
syms a(t)
creates a symbolic parameter 't' and 'a' which is an unknown function of 't'. I want an array of just this. How do I do that? I want to use this array to solve a system of ODEs using dsolve.

Accepted Answer

Walter Roberson
Walter Roberson on 8 Feb 2020
In MATLAB it not possible to create an array of symbolic functions. If you have even one symbolic function then MATLAB will build a single function that returns an array.
I was looking at this the other day and noticed that diff(a1, x) would produce a function as output but that diff(a1(x), x) would produce an expression. I was wondering whether that made a difference for dsolve purposes and made a mental note to investigate but I did not get around to it yet.
  5 Comments
Walter Roberson
Walter Roberson on 26 Apr 2022
You cannot do that with [] for reasons I explained before. Use a cell array instead.

Sign in to comment.

More Answers (1)

Victor
Victor on 24 Apr 2020
I think you can do it with for loop end "execute" command and cell array
  3 Comments
Sara Linares
Sara Linares on 25 Apr 2020
Thank you very much to both of you! You were really helpful and I really appreciate your time!!

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!