I am doing this assignment for school and I keep getting a specific error even though my code works properly.
1 view (last 30 days)
% Please enter your name inside the single quotes in the next line
name = 'Segesman Francis'; % Last Name, First Name
syms t1 x1 vy1; % Unknowns
assume(x1>0); % Eliminate the negative value of the double solution
syms t x vy y; % Variables of integration
v0 = 100; % [ft/s]
theta = 60*pi/180; % [rad] Keep in mind that we will use the angle with cos rather than cosd
vx = v0*cos(theta); % Note the difference between cos and cosd.
t0 = 0;
x0 = 0;
ay = -32.2; % [ft/s^2]
y0 = 0;
vy0 = v0*sin(theta);
y1 = -0.001*x1^2;
eqn1 = int(vx,t,t0,t1) == int(1,x,x0,x1);
eqn2 = int(ay,t,t0,t1) == int(1,vy,vy0,vy1); % Complete this line to define the second equation
eqn3 = int(ay,y,y0,y1) == int(vy,vy,vy0,vy1); % Pay attention to the integrand or the function to be integrated on the right-hand side.
[x1 t1 vy1] = solve([eqn1 eqn2 eqn3], [x1, t1, vy1]);
% If you have trouble completing the previous line, check out WK1MATLAB1 which is to solve a system of two equations.
disp('You should get: The x coordinate of the point of impact is 318.39 ft.');
fprintf('The x coordinate of the point of impact is %3.2f ft.\n',x1);
disp('You should get: The x coordinate of the point of impact is 318 ft.');
fprintf('The x coordinate of the point of impact is %.3g ft.\n',x1);
disp ('Can you tell the difference between %f and %g?');
nameInfo = isempty(name);
disp('Please enter your name in Line 2.');
%whenever I run this, i get this error: Variable x1 must be of size [1 1]. It is currently of size [0 1]. Check where the variable is assigned a value
% the program works, I am getting the correct numbers, but it looks like
% something about how the number is being stored is off.