i am not getting correct output.please help
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hrushikesh kyathari
am 19 Mai 2019
Beantwortet: madhan ravi
am 19 Mai 2019
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
0 Kommentare
Akzeptierte Antwort
madhan ravi
am 19 Mai 2019
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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Verification, Validation, and Test finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!