用Octave求曲率圆的圆心坐标
广告
{{v.name}}
设\(L:f(x)\),其中\(P(a,b) \in L\),则\(P\)点对应的的曲率圆的圆心坐标为:
\(x_{0}=a-f'(a) \frac{1+f'^{2} (a)}{f''(a)}\),\(y_{0}=b+ \frac{1+f'^{2} (a)}{f''(a)}\)
求\( y=sin(x)\)在\( x=1\)处的曲率圆的圆心坐标.
程序代码如下
function [text_result, numeric_result] = func52(x_value, y_value)
pkg load symbolic;
x = sym('x');
question = sin(x);
x0 = x_value - (diff(question, x) * (1 + power(diff(question, x), 2)) / diff(diff(question, x), x));
y0 = y_value + ((1 + power(diff(question, x), 2)) / diff(diff(question, x), x));
result_x0 = limit(x0, x, x_value);
result_y0 = limit(y0, x, x_value);
text_result = ["\nx0=", disp(result_x0), "\ny0=", disp(result_y0)];
numeric_result = [eval(result_x0), eval(result_y0)];
endfunction
结果如下
>> [text_result, numeric_result] = func52(1, sin(1))
warning: passing floating-point values to sym is dangerous, see "help sym"
warning: called from
double_to_sym_heuristic at line 50 column 7
sym at line 384 column 13
plus at line 53 column 5
func52 at line 6 column 8
text_result =
x0= 3
cos (1) cos(1)
─────── + ────── + 1
sin(1) sin(1)
y0= 2
1 cos (1) 1327
- ────── - ─────── + ────
sin(1) sin(1) 1577
numeric_result =
1.8295 -0.6938