Whay this code showing error?
2 ビュー (過去 30 日間)
古いコメントを表示
function [ time1,dist2 ] = light_speed(distances)
time1 = ((distances)./18000000);
dist2 = ((distances).*0.6215);
as you asked for my code I gave you just to see if some thing is wrong because I am getting correct answer but it is not running To get one row vector indicating time in minute to travel light to earth according to input distance vector. and 2nd output is distance converted into miles respectively input distance vector in kilometer.
2 件のコメント
Kevin Gleason
2017 年 5 月 3 日
What error message is being displayed?
Also could you clarify what you mean by "I am getting the correct answer but it is not running"?
回答 (1 件)
Santhana Raj
2017 年 5 月 3 日
The multiplication and division numbers are wrong. Try this instead:
time1 = ((distances)./(60*3e8));
dist2 = ((distances).*0.62137);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!