You are on page 1of 1

function [ seno ] = funcionseno( x, n ) %UNTITLED6 Summary of this function goes here % Detailed explanation goes here seno=0;

for i=1:1:n numero=(2*i)-1; fact=factorial(numero); seno=seno+((-1)^(i-1)*x.^(2*i-1))/fact; end

function [ m ] = biseccion_cachago( a, b, n, f ) %UNTITLED Summary of this function goes here % Detailed explanation goes here x=a; fa=eval(f); x=b; fb=eval(f); if fa*fb<0 for i=1:1:n m=(a+b)/2; x=m; fm=eval(f); if fm==0 return else if fa*fm<0 b=m; else a=m; end end end else m='error'; end

% --- Executes on button press in btngraf. function btngraf_Callback(hObject, eventdata, handles) % hObject handle to btngraf (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) f=get(handles.edtxtfuncion,'Strin g'); int=get(handles.edtxtinter,'Strin g'); t=get(handles.edtxttol,'String'); I=str2num(int); T=str2num(t); A=I(1); B=I(2); M=biseccion_casa(A,B,f,T); if M==100 set(tst,'Visible','on'); else x=A:0.01:B; y=eval(f); plot(x,y); set(handles.stxtraiz,'String',M); end

end

You might also like