Created
November 22, 2018 04:00
-
-
Save swanav/85fe9f76ec518773b194065335115523 to your computer and use it in GitHub Desktop.
Point by Point Method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; | |
clearvars; | |
t = 0; | |
tf = 0; | |
tfinal = 0.5; | |
tc = 0.125; | |
tstep = 0.005; | |
M = 2.52/(180*50); | |
i = 2; | |
delta = 21.64*pi/180; | |
ddelta = 0; | |
time(1) = 0; | |
ang(1) = 21.64; | |
Pm = 0.9; | |
Pmaxbf = 2.44; | |
Pmaxdf = 0.88; | |
Pmaxaf = 2.00; | |
while t < tfinal | |
if t==tf | |
Paminus = 0.9 - Pmaxbf*sin(delta); | |
Paplus = 0.9 - Pmaxdf*sin(delta); | |
Paav = mean([Paminus Paplus]); | |
Pa = Paav; | |
end | |
if t==tc | |
Paminus = 0.9 - Pmaxdf*sin(delta); | |
Paplus = 0.9 - Pmaxaf*sin(delta); | |
Paav = mean([Paminus Paplus]); | |
Pa = Paav; | |
end | |
if t>tf && t<tc | |
Pa = Pm - Pmaxdf*sin(delta); | |
end | |
if t>tc | |
Pa = Pm - Pmaxdf*sin(delta); | |
end | |
ddelta = ddelta + (tstep^2*Pa/M); | |
delta = (delta*180/pi + ddelta)*pi/180; | |
deltadeg = delta*180/pi; | |
time(i) = t; | |
ang(i) = deltadeg; | |
t = t+tstep; | |
i = i+1; | |
end | |
figure(1); | |
axis([0 0.6 0 160]); | |
xlabel('Time'); | |
ylabel('Angle'); | |
plot(time,ang, 'k-'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some change is needed, for the swing angle curve; plot of given code is not a swing eq. plot.