Guest User

Untitled

a guest
Sep 6th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. %info is the rf values and other information that isn't used
  2. info = [200,125,300,200,100,125,125,125;2000,400,3000,1000,300,300,2000,3000;15920,39000,2802,7960,95400,29250,195000,29250];
  3.  
  4. %whole matrix in equation form rows separated with ;, x(1) =Q(1) etc, it is
  5. %originally a flow-related problem, so Q is used normally
  6. f = @(x) [x(1)-x(2);x(2)+x(3)-x(6)-40;-x(3)+x(4)-x(7);x(5)-x(8)-20;x(6)+x(7)+x(8)-20;x(2)^2*info(3,2)-x(5)^2*info(3,5)+x(6)^2*info(3,6)+x(8)^2*info(3,8);x(3)^2*info(3,3) - x(6)^2*info(3,6) + x(7)^2*info(3,7);x(1)^2*info(3,1) + x(2)^2*info(3,2) - x(3)^2*info(3,3) - x(4)^2*info(3,4)-100];
  7. z = fsolve(f, [0 0 0 0 0 0 0 0]);
  8. %some neat new function i haven't used that solves it all with initial guesses for each x
Advertisement
Add Comment
Please, Sign In to add comment