All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
SOLUTION OF ODE clear all close all clc b=0.05; g=9.81; l=1; m=0.1; %intial conditions thetha_0=[0,5]; % time points t_span=linspace(0,50,500); % solve ODE [t,results] =ode45(@(t,thetha) ode_func(t,thetha,b,g,l,m),t_span,thetha_0); plot(t,results(:,1)) hold on plot(t,results(:,2)) ylabel(\'plot\') xlabel(\'time\') ANIMATION…
abhijeet dhillon
updated on 07 Nov 2019
SOLUTION OF ODE
clear all
close all
clc
b=0.05;
g=9.81;
l=1;
m=0.1;
%intial conditions
thetha_0=[0,5];
% time points
t_span=linspace(0,50,500);
% solve ODE
[t,results] =ode45(@(t,thetha) ode_func(t,thetha,b,g,l,m),t_span,thetha_0);
plot(t,results(:,1))
hold on
plot(t,results(:,2))
ylabel(\'plot\')
xlabel(\'time\')
ANIMATION CODE
clear all
close all
clc
b=0.05;
g=9.81;
l=1;
m=0.1;
%intial conditions
thetha_0=[0,3];
% time points
t_span=linspace(0,20,500);
% solve ODE
[t,results] =ode45(@(t,thetha) ode_func(t,thetha,b,g,l,m),t_span,thetha_0);
subplot(5,4,[13,14,17,18]);
plot(t,results(:,1),\'color\',\'b\');
hold on;
plot(t,results(:,2),\'color\',\'r\');
hold off;
subplot(5,4,[15,16,19,20]);
plot(results(:,1),results(:,2));
ylabel(\'positions-radians\')
xlabel(\'angular velocity\')
ct=1;
for i=1:length(results(:,1));
x0=1;
y0=0;
x1=1*sin(results(i,1));
y1=-1*cos(results(i,1));
subplot(5,4,[1,2,3,4,5,6,7,8,9,10,11,12])
plot([-1 1],[0 0],\'linewidth\',4,\'color\',\'r\');
hold on
line([x0 x1],[y0 y1],\'linewidth\',2,\'color\',\'b\');
hold on;
%r=0.75 %plotting the circle and mapping the center to the string
%cir_deg=linspace(0.2*pi,1000);
%xc=r*cos(cir_deg);
%yc=r*sin(cir_deg);
%plot(x1+xc,y1+yc,\'linewidth\',2);
%hold off;
plot(x1,y1,\'-o\',\'markers\',20,\'markerfacecolor\',\'r\');%plotting the bob using marker and facecolor
%r=0.25;%plot a curved rectangle and color its inner
%rectangle(\'position\',[(x1-(r/2),(y1-r/2),r,r],\'curvature\',[1
%1],\'Facecolor\',\'r\',\'linewidth\',3]
grid on;
axis( [-1.5 1.5 -1.5 0.5]);
pause(0.0003);
hold off
q(ct)=getframe(gcf);
text=fprintf(\'pendulum%d.png\',ct);
ct=ct+1;
end
movie(q)
videofile=Videowriter(\'Pendulum_damped.avi\',\'uncompressed avi\')
open(videofile)
writeVideo(videofile,g)
close(videofile)
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 2 Air standard Cycle
Aim : Your code should create a PV diagram Your should output the thermal efficiency of the engine. Solution : The code for the PV diagram is as follows : import math import matplotlib.pyplot as plt #inputs p1=101325 t1=500 gamma=1.4 t3=2300 #Geometric dimensions : bore=0.1 stroke=0.1 con_rod=0.15…
18 Jun 2022 12:07 PM IST
Bird Strike - Project - 2
Aim : The final submission must include the input file, animation, and a report. - Since this is a quite difficult and involved project, students are advised to log their debugging process and include it in the report. The log is a description of the solution process and challenges encountered along the way. …
17 Apr 2022 05:21 AM IST
Week 1 Understanding Different Battery Chemistry
Aim : 1.Prepare a table which includes materials & chemical reactions occurring at the anode and cathode of LCO, LMO, NCA, NMC, LFP and LTO type of lithium ion cells.Give your detailed explanation on it 2.Compare the differences between each type of Li+ion batteries based on their characteristics Solution :…
08 Mar 2022 03:21 PM IST
Week - 10 Hyperelastic Material Models
Aim : Given the material data below, calculate the Mooney Rivlin and Ogden material constants and compare the both using stress-strain data from a Dogbone specimen tensile test with 100 percent strain. The given data is the engineering stress-strain in MPa/(mm/mm). The comparison should be shown from the d3hsp file and…
27 Feb 2022 05:08 AM 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.