i am not getting correct output.please help

2 ビュー (過去 30 日間)
hrushikesh kyathari
hrushikesh kyathari 2019 年 5 月 19 日
回答済み: madhan ravi 2019 年 5 月 19 日
function [e]=eccentricity(a,b)
if (a||b==0)
disp('warning');
elseif a<b
temp=a;
a=b;
b=temp;
e=sqrt(1-(b^2/a^2));
else
e=sqrt(1-(b^2/a^2));
end
end

採用された回答

madhan ravi
madhan ravi 2019 年 5 月 19 日
e = eccentricity(1,2) % function call
function e = eccentricity(a,b) % function definition , a & b assumed as scalars for this task
if any(ismember([a,b],0))
e = sprintf('warning');
elseif a < b
temp = a;
a = b;
b = temp;
e = sqrt(1-(b^2/a^2));
else
e = sqrt(1-(b^2/a^2));
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by