How to linearize a function?
45 次查看(过去 30 天)
显示 更早的评论
hi
I want to linearize following function:
f(2) = ((12.85)*(x.^(-1)))+((17.72)*(x.^0.5));
回答(2 个)
John D'Errico
2018-12-23
编辑:John D'Errico
2018-12-23
It is not linear. So anything you do can only succeed as an approximation. Worse, since a singularity exists at x==0, a simple brute force linearization must fail, at least one that would be valid for all x.
However, nothing stops you from finding an expansion around some general value of x that is non-zero. Thus, a simple linearization is essentially a truncated Taylor series, but expanded around some other origin. Suppose you wanted to linearize that function around some general x0, where x0 is NOT equal to 0.
syms x x0
F = ((12.85)*(x.^(-1)))+((17.72)*(x.^0.5));
Flin = subs(F,x0) + (x-x0)*subs(diff(F,x),x0)
Flin =
257/(20*x0) + (443*x0^(1/2))/25 - (x - x0)*(257/(20*x0^2) - 443/(50*x0^(1/2)))
So around say x0==2, what happens?
ezplot(F,[0,10])
hold on
ezplot(subs(Flin,x0,2),[1 3])
legend('F(x)','Flin(x)')

The blue curve is F(x). The green line is the linearized approximation, Flin. Again, it will fail at x0==0.
Now, could I have gotten that same approximation using one call in MATLAB? Well, yes, as longas I know how to use the taylor utility in the symbolic toolbox.
taylor(F,x,'ExpansionPoint',x0,'order',2)
ans =
257/(20*x0) + (443*x0^(1/2))/25 - (x - x0)*(257/(20*x0^2) - 443/(50*x0^(1/2)))
As you see, we got the same result.
0 个评论
Star Strider
2018-12-23
Calculate the partial derivative of your function with respect to each variable, then add the value of the original function near the region of interest. See the Wikipedia article on Linearization (specifically Linearization of a Multivariable Function (link)) for details.
Here,
syms f(x)
f = ((12.85)*(x.^(-1)))+((17.72)*(x.^0.5));
f_lin = diff(f,x)
producing:
f_lin =
443/(50*x^(1/2)) - 257/(20*x^2)

0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!