How to separate an equation into several equations?
5 views (last 30 days)
Show older comments
Hi there,
If I have an equation in Matlab for example in the form f(x)=(x+1)(2x+4), how can I seperate it into two equations of the following forms: g(x)=(x+1), h(x)=(2x+4). Your help would be much appreciated.
Thank you.
0 Comments
Accepted Answer
Image Analyst
on 8 Jun 2014
Help with what? What do you want? two functions, or two array? For array, do this
fx = (x+1) .* (2*x+4);
hx = 2*x+4;
gx = x+1;
fx = gx .* hx; % Version using gx and hx.
For functions you just do
function out = g(x)
out = x+1;
function out = h(x)
out = 2 * x + 4;
If that's not what you want, then explain better.
2 Comments
Image Analyst
on 8 Jun 2014
Well you have to know what the original function is. But, are you asking how to symbolically factorize an nth order polynomial into a polynomial of x and a polynomial of order (n-1)? Or into a whole bunch of lower order polynomials? I don't know how to do that, but I'll add tags so that maybe someone else will answer.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!