% Definitions
R2D = 180/pi; % rad to deg
D2R = pi/180; % deg to rad
F2M = 0.3040; % feet to meter
m = 45.46; % kg
g = -9.8; % gravity (m/s^2)
j = sqrt(-1);
dt = 0.001; %1000Hz
R1 = 15*F2M; %m
R2 = 15*F2M;
% Initial conditions
xBall = [0; 0]; % theta/omega
% Machine initial conditions
Torque = (-1)*m*g*R1; % N-m
Pmotor = 1119000; % W
Tbreak = (4404 / 0.738)*2.3; % break torque in N-m
% Ball
I = m*(R1^2);
for launch=0:1:20
times_launched = launch + 1;
% Main loop
iter = 0;
for time=0:dt:1
% Index
iter = iter + 1;
% Torque generation and check
if( (xBall(2,1)) < ((Pmotor)/Tbreak) )
Torque = Tbreak;
else
Torque = (Pmotor)/xBall(2,1);
end
% From 0 degrees to 90 degrees
if ((xBall(1,1)*R2D) >= 0 ) ((xBall(1,1)*R2D) < 90)
% Calculate net torque
Tgrav = ( m*g*cos(xBall(1,1)))*R1;
Tnet = Torque + Tgrav;
% Calculate instantaneous angular acceleration
alphaB = Tnet/I;
% Calculate the derivative of the state
xdot = [ xBall(2,1); alphaB ];
% Integration of the state
xBall = xBall + xdot*dt;
% Dependent states
pBall = R1*( cos(xBall(1,1)) + j*sin(xBall(1,1)) );
vBall = xBall(2,1) * R1;
Power = (Tnet/R1) * vBall;
elseif ( ((xBall(1,1)*R2D) >= 90) ((xBall(1,1)*R2D) <= 180) )
% Calculate net torque
Tgrav = ( m*g*cos( xBall(1,1)) )*R1;
Tnet = Torque + Tgrav;
% Calculate instantaneous angular acceleration
alphaB = Tnet/I;
% Calculate the derivative of the state
xdot = [ xBall(2,1); alphaB ];
% Integration of the state
xBall = xBall + xdot*dt;
% Dependent states
pBall = real(vBall) * time;
Power = (Tnet/R1) * vBall;
end;
DATA(iter,:) = [ iter time xBall' alphaB Tnet xBall(1,1)*R2D ...
real(pBall) imag(pBall) real(vBall) imag(vBall) vBall Power ];
end;
end;
%% Trajectory of Projectile (y vs. x)
figure(1);
plot( DATA(:,8), DATA(:,9), '.' );
title ('Trajectory (y vs. x) of projectile during launch')
xlabel('x')
ylabel('y')
%% Range (x) vs. time
figure(2);
subplot (211), plot(DATA(:,2), DATA(:,8), '.' );
title ('Range(x) as a function of time')
ylabel('Range(x)')
%% Altitude (y) vs. time
subplot (212), plot(DATA(:,2), DATA(:,9), '.' );
title ('Altitude(y) as a function of time')
xlabel('time')
ylabel('Altitude(y)')
%% Velocity (x and y components) vs. time
figure(3);
subplot (211), plot(DATA(:,2), DATA(:,10), '.' );
title ('Velocity (x and y) as a function of time')
ylabel('Velocity(x)')
subplot (212), plot(DATA(:,2), DATA(:,11), '.' );
xlabel('time')
ylabel('Velocity(y)')
%% Velocity (total) vs. time
figure(4);
plot(DATA(:,2), DATA(:,12), '.' );
title ('Velocity(total) as a function of time')
xlabel('time')
ylabel('Velocity (total))')
%% Power vs. time
figure(5);
plot(DATA(:,2), DATA(:,13), '.' );
title ('Power as a function of time')
xlabel('time')
ylabel('Power')
Initially, the equation can be directly realized using Matlab source code. Then various inputs can be applied to it. These values can easily be plotted on a graph using plot or stem command in Matlab.
There are a lot of convolution functions in matlab, mostly in the signal processing toolbox, so it depends on what you want to do. Matlab has extensive help files available online.
You would have to write your own code for a modulation (Matlab has a convolution function not in the tools), otherwise you can use its built in function in the signal processing toolbox.
You can do this by selecting the sequence of images you want to animate and then using the Matlab's function called "im2frame". This will result in a video.
Yes, it is possible to make matlab talk in Windows using a simple program that can be downloaded here: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=15890&objectType=FILE If you are using a mac, or unix then there may be other ways to make matlab talk, but the basic code will be quite similar. Have fun. Ed
Initially, the equation can be directly realized using Matlab source code. Then various inputs can be applied to it. These values can easily be plotted on a graph using plot or stem command in Matlab.
no way... use awgn function in matlab
John G. Proakis has written: 'Introduction to digital signal processing' -- subject(s): Signal processing, Digital techniques 'Digital signal processing' 'Contemporary communication systems using MATLAB and Simulink' -- subject(s): Computer simulation, Data transmission systems, MATLAB, Telecommunication systems
You use a catapult to launch things into the air.
You can MATLAB from Java by using the matlabcontrol library available at link1. A walkthrough to get you started can be found at link2
There are a lot of convolution functions in matlab, mostly in the signal processing toolbox, so it depends on what you want to do. Matlab has extensive help files available online.
You would have to write your own code for a modulation (Matlab has a convolution function not in the tools), otherwise you can use its built in function in the signal processing toolbox.
You can do this by selecting the sequence of images you want to animate and then using the Matlab's function called "im2frame". This will result in a video.
d = det(x);
I think ill be using the different materials provided to me for different parts of the catapult that i am building/ creating.
Bahram Shahian has written: 'Control system design using Matlab' -- subject(s): Automatic control, MATLAB, System design
The probability is 1 and you do not need Matlab to get that answer - only a little bit of thought.