All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
https://drive.google.com/drive/folders/1cgFnguKAojQSi_nITflq-E1BRFg4iTj8 clear all close all clc b = 0.05; g = 9.81; l = 1; m = 1; % initial condition theta_0 = [0 3]; % time points t_span = linspace(0,20,500); % solve ODE [t, results] = ode45(@(t,theta) ode_func(t, theta, b, g, l, m), t_span, theta_0); plot(t,results(:,1))…
Aatas A G
updated on 06 Nov 2021
https://drive.google.com/drive/folders/1cgFnguKAojQSi_nITflq-E1BRFg4iTj8
clear all
close all
clc
b = 0.05;
g = 9.81;
l = 1;
m = 1;
% initial condition
theta_0 = [0 3];
% time points
t_span = linspace(0,20,500);
% solve ODE
[t, results] = ode45(@(t,theta) ode_func(t, theta, b, g, l, m), t_span, theta_0);
plot(t,results(:,1))
hold on
plot(t,results(:,2))
title('simple pendulum consisting damping')
ylabel('plot')
xlabel('time')
ct = 1;
for i = 1:length(results(:,1))
%initial points
x0 = 0;
y0 = 0;
%final locations
x1 = 1*sind(results(i,1));
y1 = -1*cosd(results(i,1));
%Plotting
figure(2)
plot([-1 1],[0 0],'linewidth',8,'color','b');
line([x0 x1],[y0 y1],'linewidth',5,'color','g')
grid on
hold on
plot(x1,y1,'o','markersize',15,'markerfacecolor','r','color','r')
axis([-2 2 -2 2]);
title('Pendulum Movement')
pause(0.3)
hold off;
M(ct) = getframe(gcf);
ct = ct+1;
end
%Making Movie
movie(M)
videofile = VideoWriter('Pendulum.avi','Uncompressed avi')
open(videofile)
writeVideo(videofile,M)
close(videofile)
function [dtheta_dt] = ode_func(t,theta,b,g,l,m)
theta1 = theta(1)
theta2 = theta(2)
dtheta1_dt = theta2;
dtheta2_dt = -(b/m)*theta2 - (g/l)*sin(theta1);
dtheta_dt = [dtheta1_dt; dtheta2_dt];
end
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Week 4 - CHT Analysis on Exhaust port
AIM: To perform the simulation of Conjugate heat transfer analysis on given exhaust port geometry by using ANSYS FLUENT. OBJECTIVE: To study the importance of Conjugate heat transfer analysis and importance of y+ value during meshing of the components. To perform the simulation of Conjugate heat transfer analysis on given…
12 Dec 2022 08:19 AM IST
Week 10 - Simulating Combustion of Natural Gas.
AIM To perform a combustion simulation on the combustor model. Objective Part I Perform a combustion simulation on the combustor model and plot the variation of the mass fraction of the different species’ in the simulation using line probes at different locations of the combustor as shown in Fig. You need to plot…
07 Dec 2022 11:26 AM IST
Week 9 - Parametric study on Gate valve.
Aim: To perform a parametric study on Gate valve. Objective: Simulate the flow of fluid through a gate valve. Perform the parametric study on the gate valve by setting design points corresponding to the positions of the lift of the spindle. Calculate the mass flow rate corresponding to all the design points Gate…
07 Dec 2022 10:12 AM IST
Project 2
AIM: To deal with the development of a forward energy-based fuel consumption model of a P1 hybrid vehicle. OBJECTIVE: Load the Project2 folder as the Current Folder in Matlab. Run the “Project2_InitFile.m” Matlab script. Copy the Conventional vehicle Simulink model created for Project 1 in this folder. Figure…
25 Oct 2022 01:11 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.