matlab - Defining an anonymous function using a symbolic expression in a vector that's already defined -
So here's the problem I'm having trouble.
You symbolize the engine, but it is parametrized by some z now you want to create the function for this expression with the variable.
Here is the code:
sys a1 a2 a4 b1 b2 b4 c1 c2 c4 [a1, a2, a4, b1, b2, b4, c1, c2, c4] = ... solution ('a1 + a4 = 1', ... 'a1 * a4 - a2 ^ 2 = 0', ... 'b1 + b4 = 7', ... 'b1 * b4 - b2 ^ 2 = 10 ', ...' c1 * c4 - c2 ^ 2 = 55/4 ', ...' c1 + c4 = 8 ', ...' C1 = a1 + b1 ', ...' c2 = A2 + b2 ', ...' c4 = a4 + b4 '); Now I can do something like this
a1 = @ (z) 13/18 - (- (35 * z ^ 2) / 81 + (280 * z) / 81 - 1 925/324) ^ (1/2) / 2 - z / 18; To define A1 is the first entry of vector A1 that was already defined ...
But I like something like this instead
a1 = @ (z) a1 (1) and then in that expression to plug values for a1 (2) or a1 ( 4) Be able to type.
How can I do this?
Ah, just browsing around the stack exchange for some related questions and finding some solutions Missed:
f = @ (t) subs (a1 (1), 'z', t).
Comments
Post a Comment