You are on page 1of 3

Introduction to mechatronics

Matlab project

‫حازم توفيق يس توفيق‬


Level 100

Part 1 :
syms r
%Set specific heat values
k1=1.3;
k2=1.4;
k3=1.667;
%Compute Efficiency with multiple specific heat
values
E1 = (1-(1./(r).^(k1-1)))*100;
E2 = (1-(1./(r).^(k2-1)))*100;
E3 = (1-(1./(r).^(k3-1)))*100;
%Plot multiple efficincies on the same figure
ezplot(E1,1,10);
hold on
ezplot(E2,1,10);
hold on
ezplot(E3,1,10);
%Set figure title and labels
xlabel('Compression Ratio');
ylabel('Cycle Efficiency');
title('cycle efficiency as a function of
compression ratio ');

part 2 :
%Set specific heat
k= 1.4;
%Set temperature(1)
T1= 400;
%Set compression ratio
r= 10;
%Compute temperature(3) from temperature ratio
Tratio = 3:0.2:10;
T3 = T1 * Tratio;

%Compute net work


netWork = T1*(1- r^(k-1)) + T3*(1-(1/r^(k-1)));

%Creat and plot new figure


figure()
plot(Tratio, netWork)

%Set figure title and labels


title('Work Done as a Function in Temperature
Ratio');
xlabel('Temperature Ratio');
ylabel('work done');

You might also like