Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Παραμετροι
- m = 1;
- k = 100;
- b = 2;
- % Function Handle
- u = @(t) sin(t);
- % Initial State
- x0(1) = 0;
- x0(2) = 1;
- tspan = [0 10];
- % Simulation
- [t, state] = ode15s(@(t, state)PROS_Exercises1_msd(t, state, m, b, k, u), tspan, x0);
- % Plot
- figure(1);
- plot(t, state(:, 1)); % Θεση
- figure(2);
- plot(t, state(:, 2)); % Ταχυτητα
- % Φυσικο πορτρετο - Τροχια
- figure(3);
- plot(state(:, 1), state(:, 2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement