How to make a function file that displays a polynomial and accepts a specific command?
Show older comments
function lou(a,b,c)
fprintf('%dx^2 + %dx + %d =0 \n',a,b,c)
end
this is my code right now. how do i modify my code to make the command lou([a b c]) work?
Accepted Answer
More Answers (1)
val = lou(1,2,3,.2)
function val = lou(a,b,c,x)
fprintf('%dx^2 + %dx + %d =0 \n',a,b,c)
val = a*x^2+b*x+c ;
end
Categories
Find more on Two-Phase Fluid Library in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!