如何在matlab中创建矩阵函数
how to create matrix functions in matlab
I want to Implement the following trigonometric system of equations in MATLAB
我应该为 x1,x2 and x4
编写什么脚本?
您可以尝试在函数 f
中构建方程组,然后使用 fsolve
求解该方程组,即
function y = f(x)
y = zeros(3,1);
y(1) = cos(x(1)-x(2)-x(3)) - 0.707;
y(2) = 5*cos(x(1)) + 3*cos(x(1)-x(2)) - 3;
y(3) = 5*sin(x(1)) + 3*sin(x(1)-x(2)) - 4;
end
[x, fval, info] = fsolve (@f, [0;0;0])
这样
x =
1.5367
1.8755
-1.1244
fval =
-0.000000014158
-0.000000103868
-0.000000551463
info = 1
I want to Implement the following trigonometric system of equations in MATLAB
x1,x2 and x4
编写什么脚本?
您可以尝试在函数 f
中构建方程组,然后使用 fsolve
求解该方程组,即
function y = f(x)
y = zeros(3,1);
y(1) = cos(x(1)-x(2)-x(3)) - 0.707;
y(2) = 5*cos(x(1)) + 3*cos(x(1)-x(2)) - 3;
y(3) = 5*sin(x(1)) + 3*sin(x(1)-x(2)) - 4;
end
[x, fval, info] = fsolve (@f, [0;0;0])
这样
x =
1.5367
1.8755
-1.1244
fval =
-0.000000014158
-0.000000103868
-0.000000551463
info = 1