简体   繁体   中英

how to create matrix functions in matlab

I want to Implement the following trigonometric system of equations in MATLAB

在此处输入图像描述 What script should i write solve for x1,x2 and x4 ?

You can try build a system of equations in a function f and use fsolve to solve the system, ie,

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])

such that

x =

   1.5367
   1.8755
  -1.1244

fval =

  -0.000000014158
  -0.000000103868
  -0.000000551463

info =  1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM