필터 지우기
필터 지우기

Whay this code showing error?

조회 수: 1 (최근 30일)
Purvil Patel
Purvil Patel 2017년 4월 30일
답변: Santhana Raj 2017년 5월 3일
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
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"?
Jan
Jan 2017년 5월 3일
편집: Jan 2017년 5월 3일
@Purvil: I've formatted your code this time. Please use the "{} Code" button in the future. Thanks.
What does the tag "ans is correct but showing that incorrect with 150000000." mean? It sounds like the answer is correct, but wrong.

댓글을 달려면 로그인하십시오.

답변 (1개)

Santhana Raj
Santhana Raj 2017년 5월 3일
The multiplication and division numbers are wrong. Try this instead:
time1 = ((distances)./(60*3e8));
dist2 = ((distances).*0.62137);

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by