please i want to know where is the mistake in the this code
Info
This question is closed. Reopen it to edit or answer.
Show older comments
[R,tof] = Q1_STNO(v,theta);
G=9.81;
R=Q1_0123456(v,theta);
R=(v^2)*sin(2*theta)/g;
tof=Q1_0123456(v,theta);
tof=2*v*sin(theta)/g;
disp([‘Answer = ‘ num2str(R)’]);
disp([‘Answer = ‘ num2str(theta)’]);
Answers (6)
Image Analyst
on 16 Nov 2013
Your quotes are messed up in the disp statement. Try it like this instead:
fprintf('R Answer = %f\n', R);
fprintf('theta Answer = %f\n', theta);
Roger Stafford
on 16 Nov 2013
0 votes
In the first line you compute R and tof. In the third and fourth lines you overwrite R. In the fifth and sixth lines you overwrite tof. This means that the first, the third, and the fifth lines of code are entirely ignored and accomplish nothing. What is it you actually wish to calculate?
mohammad Mohsen
on 17 Nov 2013
0 votes
1 Comment
Image Analyst
on 17 Nov 2013
So give a value to v before you call that function. How is it supposed to know what v is unless you tell it?
mohammad Mohsen
on 20 Nov 2013
0 votes
1 Comment
Image Analyst
on 20 Nov 2013
Is it your intent to call this recursively? Because Q1_0123456() calls itself from inside itself.
mohammad Mohsen
on 20 Nov 2013
mohammad Mohsen
on 20 Nov 2013
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!