Project

Otto

%please consider late submission

clc
clear all
close all
%OTTO CYCLE
p0=input(\'Enter initial pressure \\n\')
v0=input(\'Enter the initial volume \\n\')

p1=p0;
v1=v0+5;
c=(p1)*(v1)^1.4;

v2=v0;
p2=c/(v2)^1.4;

v3=v0;
p3=p2+5;
c1=(p3)*(v3)^1.4;
v4=v1;
p4=c1/(v4)^1.4;
sp=1:.25:5

ct=1

for i=0:5
if i==0
for j= 1:length(sp)
x= v0 +sp(j);
y= p0;

plot([v0,x],[p0,y])
xlabel(\'volume--->\');
ylabel(\'pressure--->\');

axis([0 20 0 20])

pause(.125)
end
end

if i==1
for j= 1:length(sp)
x= v1:-.25:v1-sp(j);
y= c./(x).^1.4;

plot([v0,v1],[p0,p1],[v1,x],[p1,y])
xlabel(\'volume--->\');
ylabel(\'pressure--->\');
axis([0 20 0 20])

pause(.125)
end
end

if i==2
for j= 1:length(sp)
x1= v2
y1= p2+ sp(j);
plot([v0,v1],[p0,p1],[v1,x],[p1,y],[v2,x1],[p2,y1])
xlabel(\'volume--->\');
ylabel(\'pressure--->\');


axis([0 20 0 20])

pause(.125)
end
end

if i==3
for j= 1:length(sp)
x2= v3:.25:v3+sp(j);
y2= c1./(x2).^1.4;

plot([v0,v1],[p0,p1],[v1,x],[p1,y],[v2,x1],[p2,y1],[v3,x2],[p3,y2])
xlabel(\'volume--->\');
ylabel(\'pressure--->\');
axis([0 20 0 20])

pause(.125)
end
end
if i==4
for j= 1:length(sp)
x3= v4
y3= p1
plot([v0,v1],[p0,p1],[v1,x],[p1,y],[v2,x1],[p2,y1],[v3,x2],[p3,y2],[v4,x3],[p4,y3])

xlabel(\'volume--->\');
ylabel(\'pressure--->\');


axis([0 20 0 20])

pause(.125)
end
end
if i==5
for j= 1:length(sp)
x4= v1 -sp(j);
y4= p0;

plot([v0,v1],[p0,p1],[v1,x],[p1,y],[v2,x1],[p2,y1],[v3,x2],[p3,y2],[v4,x3],[p4,y3],[v1,x4],[p1,y4])

xlabel(\'volume--->\');
ylabel(\'pressure--->\');
axis([0 20 0 20])

pause(.125)
end
end

end

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.