Question

In: Mechanical Engineering

Write an Matlab Program for Wankel Engine Gemontry. State your and assumptions and post the code

Write an Matlab Program for Wankel Engine Gemontry.

State your and assumptions and post the code

Solutions

Expert Solution

clear; clc;

R1 = 2; % Radius of fixed circle R2 = (3/2)*R1; % Radius of moving circle (circle 2 which is rolling on the inner side of cirle 1) E = 7; % Excentricity: This is the distance between the drawing/tracking point and the center of circle 2

df1 = 1; % The angel step size of the center of circle 2 regarding center to the center of cirle 1 [°] df2 = df1 * (1 - R1/R2); % Rotation of circle 2

z0 = (R1-R2) + 0i; % Position of center of circle 2 (as a complex number z=x+y*i) (i=imaginary unit)

c1 = E * exp ( i * 0 * (pi/180)); % Position of the first drawing/tracking point (first corner of the piston) c2 = E * exp ( i * 120 * (pi/180)); % Position of the second drawing/tracking point (second corner of the piston) c3 = E * exp ( i * 240 * (pi/180)); % Position of the third drawing/tracking point (third corner of the piston)

Piston = [c1 c2 c3]; % The piston is the triangle created by the three corners c1, c2 & c3 Piston = Piston + z0; HoleInPiston = R2 * exp([0:3:360] * i * (pi/180)); CrankShaft = R1 * exp([0:3:360] * i * (pi/180));

figure(1); hold on; grid on; box on; axis equal; xlim([-13 13]) ylim([-13 13]) ScreenShot = getframe;

for k = 1 : 3*360 % 'k' because i already used for imaginary no.

    % Pure translation of the center of circle 2:
        z0 = z0 * exp ( i * df1 * (pi/180)); 
    % Whole triangle (piston) has to follow the center:
        Piston = Piston - mean(Piston) + z0;
        HoleInPiston = HoleInPiston - mean(HoleInPiston) + z0;
    % Final step: Pure rotation of circle 2 ( = pure rotation of the piston)
    %   Step is: Bring whole piston to the center of cirle 1, rotate it and bring it back to old position
        Piston = (Piston - z0) * exp ( i * df2 * (pi/180)) + z0;
    plot( real(Piston(1)) , imag(Piston(1)), 'r.')
    plot( real(Piston(2)) , imag(Piston(2)), 'b.')
    plot( real(Piston(3)) , imag(Piston(3)), 'g.')
    fill( real(Piston) , imag(Piston), 'y');     % Deleting the piston from the figure
    fill( real(HoleInPiston) , imag(HoleInPiston), 'w')
    fill( real(CrankShaft) , imag(CrankShaft), 'k')
    ScreenShot(end+1) = getframe;
    TheCurrentAxisOfTheDiagram = get(gca);
    AllCurvesInTheFigure = TheCurrentAxisOfTheDiagram.Children;
    delete (  AllCurvesInTheFigure(1) ); %Deleting the  from the figure
    delete (  AllCurvesInTheFigure(2) ); %Deleting the  from the figure
    delete (  AllCurvesInTheFigure(3) ); %Deleting the piston from the figure

end

fill( real(Piston) , imag(Piston), 'y'); % Deleting the piston from the figure fill( real(HoleInPiston) , imag(HoleInPiston), 'w') fill( real(CrankShaft) , imag(CrankShaft), 'k')


Related Solutions

Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Develop three functions for temperature-conversion. Create a function called F_to_K that converts and return temperatures in Fahrenheit to Kelvin and store results in ‘F_to_K2.txt’. Create a function called C_to_R that converts and return temperatures in Celsius to Rankine and store results in ‘C_to_R2.txt’. Create a function called C_to_F that...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Write a user defined function ‘My_FunctionGen’. It accepts, the time vector ‘t’ with 8000 uniformly spaced values within the range of 0 to 8, Frequecy scalars ‘f1<100H’ and ‘f2<80Hz’ and Amplitude scalars ‘A1’, ‘A2’ and ‘A3’ as input arguments. It delivers x1, x2 and x3 and x4 as outputs...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Generate the following vectors and also implement the Table-1 operations-map by employing the switch statement and an appropriate loop. Generate a vector ‘DEC1’ as follow. DEC1 = 5     1     3     0     2    5     0     2 Concatenate vector ‘DEC1’ eight times in order to obtain a bigger row vector ‘DEC’...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your...
Write a MATLAB code to obtain the following. Keep your code commented whenever required. Copy your source code and command widow outcomes and screen shots of any plots in your solution. Develop three functions for temperature-conversion. Create a function called F_to_K that converts and return temperatures in Fahrenheit to Kelvin and store results in ‘F_to_K2.txt’. Create a function called C_to_R that converts and return temperatures in Celsius to Rankine and store results in ‘C_to_R2.txt’. Create a function called C_to_F that...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program,...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program, quadroots.m, for finding the roots of the second- order polynomial ax2 + bx + c. Use the quadratic equation. The inputs are the coefficients a,b, and c and the outputs are z1 and z2. The program should produce (exactly) the following output in the Command window when run with (a, b, c) = (1, 2, −3):
write the code in MATLAB with comments and show the inputs and results of the code...
write the code in MATLAB with comments and show the inputs and results of the code for the question below. Write an .m file in MATLAB, that records audio (you can record your own voice for 20 seconds that was recorded using your phone), then take Fourier transform of the signal (probably FFT).
show the MATLAB Code with comments and Write an .m file in MATLAB, that records audio...
show the MATLAB Code with comments and Write an .m file in MATLAB, that records audio (you can record your own voice for 20 seconds), takes Fourier transform of the signal (probably FFT).
write a matlab code to simulate fiber optics communication system on matlab simulink
write a matlab code to simulate fiber optics communication system on matlab simulink
I'm new in MATLAB and I have to write a code in MATLAB which converts a...
I'm new in MATLAB and I have to write a code in MATLAB which converts a number from one base to another without using base2base, etc
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a...
Write a matlab code for given task Use your ‘sin’ or ‘cos’ function to generate a sinusoid wave having two components as f1 = 3kHz and f2 = 5kHz and then sample it with fs = 10kHz. Calculate its fft with zero frequency component in the middle. Plot it on a properly scaled w-axis. Specify if there is aliasing or not? If there is aliasing specify which component is casing the aliasing
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT