MATLAB Answers

how can i add second engine?

1 view (last 30 days)
gultekin karahasan
gultekin karahasan on 10 Apr 2020
Answered: Ameer Hamza on 11 Apr 2020
function []=BurnFraction()
% this program computes and plots the cumulative burn fraction
% and the instantanous burnrate
clear();
a = 5; % Weibe efficiency factor
n = 3; % Weibe form factor
thetas = -20; % start of combustion of engine 1
thetad = 40; % duration of combustion of engine 1
theta=linspace(thetas,thetas+thetad,100); %crankangle theta vector
dum=(theta-thetas)/thetad; % theta diference vector
temp=-a*dum.^n;
xb=1.-exp(temp); %burn fraction
dxb=n*a*(1-xb).*dum.^(n-1); %element by element vector multiplication
%plot results
plot(theta,xb,'b','linewidth',2);
set(gca, 'fontsize', 18,'linewidth',2);
%grid
xlabel('Crank Angle (deg)','fontsize', 18);
ylabel('Xb','fontsize', 18);
figure();
plot(theta,dxb,'b','linewidth',2);
set(gca, 'fontsize', 18,'linewidth',2);
%grid
xlabel('Crank Angle (deg)','fontsize', 18);
ylabel('Dxbdtheta (1/deg)','fontsize', 18);
end
QUESTİON
I have 2 engines i want to compare each other ;1.engine thetas=-20 thetad=40. 2.engine thetas=-20 thetad=40
I want to both of their values on same graphic.I want to compare.Can u help me?In this script is for 1 engine,how can i add second engine?

  0 Comments

Sign in to comment.

Answers (1)

Ameer Hamza
Ameer Hamza on 11 Apr 2020
Try this
function []=BurnFraction()
% this program computes and plots the cumulative burn fraction
% and the instantanous burnrate
clear();
a = 5; % Weibe efficiency factor
n = 3; % Weibe form factor
thetas = [-20 -10]; % start of combustion of engine 1
thetad = [40 20]; % duration of combustion of engine 1
%plot results
figure();
hold on;
for i=1:numel(thetas)
theta=linspace(thetas(i),thetas(i)+thetad(i),100); %crankangle theta vector
dum=(theta-thetas(i))/thetad(i); % theta diference vector
temp=-a*dum.^n;
xb=1.-exp(temp); %burn fraction
plot(theta,xb,'b','linewidth',2);
set(gca, 'fontsize', 18,'linewidth',2);
%grid
xlabel('Crank Angle (deg)','fontsize', 18);
ylabel('Xb','fontsize', 18);
end
figure();
hold on;
for i=1:numel(thetas)
theta=linspace(thetas(i),thetas(i)+thetad(i),100); %crankangle theta vector
dum=(theta-thetas(i))/thetad(i); % theta diference vector
temp=-a*dum.^n;
xb=1.-exp(temp); %burn fraction
dxb=n*a*(1-xb).*dum.^(n-1); %element by element vector multiplication
plot(theta,dxb,'b','linewidth',2);
set(gca, 'fontsize', 18,'linewidth',2);
%grid
xlabel('Crank Angle (deg)','fontsize', 18);
ylabel('Dxbdtheta (1/deg)','fontsize', 18);
end
end

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!