Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Lab 5.
- % Marta Trzaska 171632 SiSR
- function [u_C, i_L] =euler(x_0, funkcja, t, h)
- global C L E R;
- t_h = t/h;
- u_C = zeros(1, t_h + 1);
- i_L = zeros(1, t_h + 1);
- u_C(1) = x_0(1)
- i_L(1) = x_0(2)
- for i=2:(length(t_h)+1)
- if(i == 1)
- elseif(i > 1)
- [f_uC, f_iL] = funkcja(C, i_L(i-1), L, E, R, u_C(i-1));
- u_C(i) = u_C(i-1) + h*f_uC;
- %x_i(:,i) = x;
- i_L(i) = i_L(i-1) + h*f_iL;
- end
- end
- end
Add Comment
Please, Sign In to add comment