Can you store symbolic functions in a matrix/vector?
Show older comments
I am trying to write a finite element code. I want to consider the basis functions
.
.So I need to be able to store them in a matrix/vector such as:
. In matlab I tried the following ,
. In matlab I tried the following ,phi=@(x,y)1/h.*[1-x-y;x;y]
but I either get an error for variables not being defined (which is the point at this stage). From here I want to do something like the following, but I can't see how. Any help would be appreciated!
phi(1)=1/h[1-x-y]
1 Comment
madhan ravi
on 4 Feb 2019
syms x y
phi=(1/h)*[1-x-y;x;y]
Accepted Answer
More Answers (1)
Sebastian Pakula
on 6 Sep 2020
There is a way of picking one of the function from matrix (or vector) of functions. Try this:
syms x y
h=10;
phi=(1/h)*[1-x-y;x;y];
% if you need second function write:
f2=[0 1 0]*phi;
% if you need third one:
f3=[0 0 1]*phi;
1 Comment
Walter Roberson
on 6 Sep 2020
You do not show any functions, only expressions.
For expressions you can just index directly, phi(2) for example.
You also need to be careful about 0 times infinity, which would normally be nan.
Categories
Find more on Number Theory in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!