MATLAB: How to write a function that combines four methods? (secant, msecant, fixed-point, newton-raphson) I have already created the matlab program for all four with the answer. I just need to know how to create one matlab code that run all of them as one

combining functions

function y = secant(a,b,es,imax)
function y = msecant(b,d,es,imax)
function y = fixedpoint(b,es,imax)
function y = newtonraphson(b,es,imax)
%%%program that computes the answer for all methods in one program

Best Answer

function [y1,y2,y3,y4] = AllMethods(a,b,d,es,imax)
% Secant Method
y1 = secant(a,b,es,imax) ;
% Msecant method
y2 = msecant(b,d,es,imax) ;
% Fixed point method
y3 = fixedpoint(b,es,imax) ;
% Newton Raphson method
y4 = newtonraphson(b,es,imax) ;
It is your choice, whether you call a function inside or type the code itself.
Related Question