Guest User

Untitled

a guest
Sep 11th, 2019
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. % Laboration i FMM
  2. %% Uppgift 1
  3. clear all
  4. load randwebs
  5. load randinits
  6. A = randwebscell{3};
  7. x = randinitscell{3};
  8. opts = odeset('NonNegative',1);
  9. K = zeros(10);
  10.  
  11.  
  12.  
  13. tmax = 1001;
  14. y= zeros(length(x), tmax);
  15. y(:, 1) = x;
  16. disp('hej')
  17. for t = 1:tmax-1
  18. for i = 1:10
  19. K(i, :) = y(i, t).*A(i,:).*(y(i, t))';
  20. end
  21. for i = 1:10
  22. [tout,yout] = (ode45(@(t,y) sum(K(i,:)),[0 0.1],y(i, t),odeset('NonNegative',1))) ;
  23. y(i, t+1) = yout(end);
  24. end
  25. end
  26. plot(1:tmax, y)
  27. % [r,t] = ode45(@(x, A) odefunc(x, A),[0,2],x(1))
  28. % odefunc(x,A)
  29. % function dxdt = odefunc(a,b)
  30. %
  31. % for i = 1:10
  32. % for j = 1:10
  33. % dxdt(i) = a(i).*a(j).*b(i,j);
  34. % end
  35. % end
  36. % end
RAW Paste Data