Sunteți pe pagina 1din 21

Trabajo de Métodos

Universidad nacional de Juliaca


Escuela Profesional: Ingeniería en Energías Renovables
Profesora: Ing Vilma Sarmiento Mamani
Curso: Métodos Numéricos
Semestre: V

Pertenece: Vilca Contreras Luisa Marina


Código: 76166614
PRACTICA

Solución de ecuaciones no lineales

1. Aplicar el método de Bisección y de Newton-Raphson con una tolerancia de 0.0001


para aproximar una raíz de:

f(x) = 4x3 – x2 + 1

Anotar el número de iteraciones y la raíz encontrada:

Método Intervalo inicial Resultado N°de iteraciones

Bisección [-1, 0] -0.55670166 14

Bisección [-1.5, 1] -0.55662536 14

Bisección [-10, 0] -0.55671691 16

Bisección [-100, 100] -0.55662536 19

Bisección [-1000, 1000] -0.55662536 24

Método Valor inicial Resultado N° de iteraciones

Newton-Raphson -1 -0.556393 5

Newton-Raphson -10 -0.556393 11

Newton-Raphson -100 -0.556393 16

Newton-Raphson -1000 -0.556393 22

Newton-Raphson 100 -0.556393 19

Newton-Raphson 1000000 -0.556393 47


SOLUCIÓN Bisección
Solución Newton-Raphson

ITERACCION X F´(X) F(X) ERROR


1 -1 14 -4
-
2 0.71428571 9.31021068 -1.66 -0.4
- -
3 0.53598685 12.4073016 2.07914568 -0.3326553
- - -
4 0.36841248 18.0508282 2.84291395 0.45485528
- - -
5 0.21091755 31.5296208 4.66707016 0.74671325
ITERACCION X F´(X) F(X) ERROR
1 -10 1220 -4099
2 -6.64016393 1.00150396 -0.53553882 -0.50598692
3 -6.10542933 1.08921914 -0.54740978 -0.08758346
4 -5.60285849 1.18692102 -0.56063229 -0.08969901
5 -5.13051679 1.29619505 -0.57542092 -0.09206513
6 -4.68658598 1.41897546 -0.59203745 -0.09472371
7 -4.26935716 1.55764679 -0.61080457 -0.09772638
8 -3.87722425 1.71518335 -0.63212482 -0.10113754
9 -3.50867775 1.89534376 -0.65650688 -0.10503857
10 -3.16229896 2.10294807 -0.68460307 -0.10953385
11 -2.83675451 2.34428128 -0.71726397 -0.11475947

ITERACCION X F´(X) F(X) ERROR


1 -100 120200 -4009999
2 -66.6389434 0.09979376 -0.41350562 -0.50062403
3 -62.4953414 0.10641034 -0.41440107 -0.06630258
4 -58.6009729 0.11348191 -0.41535811 -0.0664557
5 -54.9408468 0.12104201 -0.41638125 -0.0666194
6 -51.5008737 0.12912695 -0.41747543 -0.06679446
7 -48.2678116 0.13777609 -0.41864597 -0.06698174
8 -45.229215 0.14703219 -0.41989864 -0.06718217
9 -42.373387 0.15694168 -0.42123975 -0.06739674
10 -39.6893342 0.1675551 -0.42267612 -0.06762655
11 -37.1667246 0.17892754 -0.42421521 -0.0678728
12 -34.7958475 0.19111908 -0.42586516 -0.06813678
13 -32.5675762 0.20419544 -0.42763485 -0.06841993
14 -30.4733333 0.21822852 -0.42953402 -0.06872379
15 -28.5050571 0.23329722 -0.43157334 -0.06905007
16 -26.6551707 0.2494882 -0.43376456 -0.06940066

ITERACCION X F´(X) F(X) ERROR


1 -1000 12002000 -4000999999
2 -666.638894 0.00997564 -0.40135006 -0.50006249
3 -626.405886 0.01061636 -0.40143677 -0.06422834
4 -588.592854 0.01129839 -0.40152907 -0.0642431
5 -553.054238 0.01202441 -0.40162733 -0.06425883
6 -519.653235 0.01279728 -0.40173192 -0.06427556
7 -488.26127 0.01362007 -0.40184328 -0.06429338
8 -458.7575 0.014496 -0.40196182 -0.06431234
9 -431.028353 0.01542857 -0.40208803 -0.06433254
10 -404.967087 0.01642146 -0.4022224 -0.06435403
11 -380.473381 0.01747862 -0.40236547 -0.06437693
12 -357.452946 0.01860427 -0.40251781 -0.0644013
13 -335.817168 0.01980289 -0.40268003 -0.06442725
14 -315.482761 0.02107928 -0.40285277 -0.06445489
15 -296.371449 0.02243857 -0.40303673 -0.06448432
16 -278.409663 0.02388621 -0.40323265 -0.06451567
17 -261.528261 0.02542804 -0.40344131 -0.06454906
18 -245.662258 0.0270703 -0.40366357 -0.06458462
19 -230.75058 0.02881965 -0.40390032 -0.06462249
20 -216.735825 0.03068321 -0.40415252 -0.06466285
21 -203.564043 0.03266859 -0.40442121 -0.06470584
22 -191.184531 0.03478394 -0.40470749 -0.06475164

ITERACCION X F´(X) F(X) ERROR


1 100 119800 3990001
2 66.6944825 -0.09971065 -0.38650563 -0.49937441
3 62.8182103 -0.10586342 -0.38567294 -0.06170619
4 59.1750922 -0.11238091 -0.3847909 -0.06156506
5 55.751104 -0.11928285 -0.38385682 -0.06141561
6 52.5330653 -0.12658981 -0.38286793 -0.06125739
7 49.5085884 -0.13432317 -0.38182134 -0.06108994
8 46.6660309 -0.14250517 -0.38071402 -0.06091278
9 43.9944504 -0.15115885 -0.37954287 -0.0607254
10 41.4835628 -0.16030808 -0.37830466 -0.06052729
11 39.1237027 -0.16997753 -0.37699604 -0.06031791
12 36.9057858 -0.18019263 -0.37561358 -0.06009673
13 34.8212744 -0.19097953 -0.37415373 -0.05986316
14 32.8621444 -0.20236508 -0.37261286 -0.05961662
15 31.020854 -0.21437677 -0.37098726 -0.05935653
16 29.2903155 -0.22704264 -0.36927312 -0.05908228
17 27.6638672 -0.24039121 -0.36746659 -0.05879324
18 26.1352481 -0.2544514 -0.36556375 -0.05848879
19 24.698574 -0.26925241 -0.36356065 -0.0581683
ITERACCION X F´(X) F(X) ERROR
1 1000000 1.2E+13 4E+18
2 666666.694 -9.9752E-06 -0.39999865 -0.49999994
3 626567.485 -1.0614E-05 -0.39999856 -0.06399823
4 588880.203 -1.1293E-05 -0.39999847 -0.06399821
5 553459.775 -1.2016E-05 -0.39999837 -0.0639982
6 520169.85 -1.2785E-05 -0.39999827 -0.06399818
7 488882.281 -1.3603E-05 -0.39999816 -0.06399816
8 459476.629 -1.4473E-05 -0.39999804 -0.06399815
9 431839.698 -1.54E-05 -0.39999792 -0.06399813
10 405865.101 -1.6385E-05 -0.39999778 -0.0639981
11 381452.85 -1.7434E-05 -0.39999764 -0.06399808
12 358508.972 -1.8549E-05 -0.39999749 -0.06399806
13 336945.146 -1.9737E-05 -0.39999733 -0.06399803
14 316678.363 -2.1E-05 -0.39999716 -0.063998
15 297630.607 -2.2344E-05 -0.39999698 -0.06399798
16 279728.554 -2.3774E-05 -0.39999678 -0.06399794
17 262903.293 -2.5295E-05 -0.39999658 -0.06399791
18 247090.054 -2.6914E-05 -0.39999636 -0.06399788
19 232227.966 -2.8636E-05 -0.39999612 -0.06399784
20 218259.818 -3.0469E-05 -0.39999588 -0.0639978
21 205131.84 -3.2419E-05 -0.39999561 -0.06399776
22 192793.498 -3.4494E-05 -0.39999533 -0.06399771
23 181197.294 -3.6701E-05 -0.39999503 -0.06399766
24 170298.591 -3.905E-05 -0.39999472 -0.06399761
25 160055.433 -4.1549E-05 -0.39999438 -0.06399756
26 150428.392 -4.4208E-05 -0.39999402 -0.0639975
27 141380.408 -4.7037E-05 -0.39999363 -0.06399744
28 132876.651 -5.0048E-05 -0.39999323 -0.06399738
29 124884.387 -5.325E-05 -0.39999279 -0.06399731
30 117372.849 -5.6658E-05 -0.39999233 -0.06399723
31 110313.123 -6.0284E-05 -0.39999184 -0.06399715
32 103678.033 -6.4142E-05 -0.39999132 -0.06399707
33 97442.0368 -6.8247E-05 -0.39999076 -0.06399698
34 91581.1296 -7.2615E-05 -0.39999017 -0.06399689
35 86072.7502 -7.7262E-05 -0.39998954 -0.06399679
36 80895.6944 -8.2206E-05 -0.39998887 -0.06399668
37 76030.0335 -8.7467E-05 -0.39998816 -0.06399657
38 71457.0372 -9.3065E-05 -0.39998741 -0.06399644
39 67159.1021 -9.9021E-05 -0.3999866 -0.06399631
40 63119.6836 -0.00010536 -0.39998574 -0.06399618
41 59323.2322 -0.0001121 -0.39998483 -0.06399603
42 55755.1336 -0.00011927 -0.39998386 -0.06399588
43 52401.6525 -0.00012691 -0.39998282 -0.06399571
44 49249.8801 -0.00013503 -0.39998173 -0.06399554
45 46287.6837 -0.00014367 -0.39998056 -0.06399535
46 43503.6604 -0.00015286 -0.39997931 -0.06399515
47 40887.0935 -0.00016265 -0.39997799 -0.06399494

1.1.- ¿La aproximación obtenida con bisección es exactamente igual a la aproximación


obtenida con Newton-Raphson?

No, difieren en los dígitos menos significativos.

1.2.- En los casos de Newton-Raphson el valor inicial creció hasta un millón de veces.
¿Cómo creció el número de iteraciones para llegar a la aproximación de la raíz?
a) El número de iteraciones creció también alrededor de un millón.
b) El número de iteraciones no aumentó demasiado.
c) El número de iteraciones fue el mismo.

2.-Si se varía la tolerancia para la función anterior, ¿en cuántas iteraciones se encuentra
la raíz?

Bisección Newton-Raphson

raíz obtenida iteraciones raíz obtenida iteraciones

2.1.-Con [-1 0] -0.554688 7 -0.556693 5


tolerancia de
0.01
[-10 0] -0.556641 10 -0.556693 11
[-100 100] -0.55542 15 -0.556693 16

[-1000 1000] -0.556946 16 -0.556693 22

2.2.-Con [-1 0] -0.556693 20 -0.556693 6


tolerancia de
0.00000001
[-10 0] -0.556693 21 -0.556693 12

[-100 100] -0.556693 28 -0.556693 17

[-1000 1000] -0.556693 32 -0.556693 23

2.3.-¿Con cuál de los dos métodos aumentaron más las iteraciones al disminuir la
tolerancia?

Se aumentó con el método de bisección.

de 0.0001 para encontrar la raíz de:

f(x) = x3 + 0.5x2 - 2.5x +1 = 0


¿En cuántas iteraciones se encuentra la raíz?

Raíz Iteraciones
Si el valor inicial es de 2: 1 6
Si el valor inicial es de 1000: 1 22
Si el valor inicial es de 1000000: 1 39
Si el valor inicial es de -10: -2 8
3.5. Si el valor inicial es de 0.1: 0.49999 5

4.-Aplicar el método de Bisección y de Newton-Raphson con una tolerancia de 0.0001 para


encontrar la raíz de

f(x) = Cos(x) – x2
Anotar el número de iteraciones y la raíz encontrada:

Intervalo inicial raíz N° de iteraciones

bisección [-0.5, 1.5] 0.82415771 14

secante Tome el valor ud.

Newton- 8 0.824132 7
raphson

5.-Si se varía la tolerancia para la función anterior, ¿en cuántas iteraciones se encuentra
la raíz?

tolerancia bisección Newton raphson

Intervalo inicial: [-0.5,1.5] Valor inicial=8

Raíz obtenida iteraciones Raíz obtenida Iteraciones

0.01 0.8203125 7 0.82413234 6

0.000001 0.83413231 27 0.82413234 8

6.- sea la función =cos(x)-x^2. Usando bisección y tolerancia 0.0001, ¿en cuántas
iteraciones se encuentra la raíz?
Intervalo inicial raíz N° de iteraciones
[-0.5;1] 0.28412719 13

[0;1] 0.82415771 13
[-1000;1000] -0.82415342 24

¿La aproximación a la raíz es exactamente la misma en todos los casos anteriores?

No, difiere en los dígitos menos significativos.


7.-completa lo siguiente usando el método de bisección para obtener una de las raíces
de f(x)=cos(x) con una tolerancia de 0.0001.
Intervalo inicial raíz N° iteraciones
[0,10] 7.854 12
[0,100]
[0.1000]

En matlab
function pb_grafica2_Callback(hObject, eventdata, handles)
axes(handles.axes1);
x=str2double(get(handles.edit10,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');

% --- Executes on button press in pushbutton1.


function pushbutton1_Callback(hObject, eventdata, handles)
syms x
cf=get(handles.edit1h,'string');
f=inline(cf);
dg=diff(cf,x);
df=inline(dg);
x=str2double(get(handles.edit2vi,'String'));
tol=str2double(get(handles.edit3tol,'String'));
n=0; error=100;
while(error>tol)
xa=x;
x=x-f(x)/df(x);
error=abs(((x-xa)/x)*100);
error=double(error);
x = double(x);
n=n+1;
end
set(handles.ra,'String',x);
set(handles.iter,'String',n);
set(handles.er,'String',error);

% --- Executes on button press in pushbutton3.


function pushbutton3_Callback(hObject, eventdata, handles)
set(handles.edit1h,'String','');
set(handles.edit2vi,'String','');
set(handles.edit3tol,'String','');
set(handles.ra,'String','');
set(handles.iter,'String','');
set(handles.er,'String','');
axes(handles.axes2);
cla('reset');
set(handles.xl,'String','');
set(handles.xu,'String','');
set(handles.tol2,'String','');
set(handles.edit10,'String','');
set(handles.edit11,'String','');
set(handles.edit10,'String','');
set(handles.uitable1,'Data','');
set(handles.uitable2,'Data','');
axes(handles.axes1);
cla('reset');
if ispc && isequal(get(hObject,'BackgroundColor'),
get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pb_grafica1.


function pb_grafica1_Callback(hObject, eventdata, handles)
axes(handles.axes2);
x=str2double(get(handles.ra,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');
function pushbutton4_Callback(hObject, eventdata, handles)
syms x
def=get(handles.edit1h,'string');
f=inline(def);
x0=str2double(get(handles.xl,'string'));
x1=str2double(get(handles.xu,'string'));
tol=str2double(get(handles.tol2,'string'));
n=0;
if f(x0)*f(x1)<0
x=x0;
while abs(f(x))>tol
x=(x0+x1)/2;
n=n+1;
if f(x0)*f(x)<0
x1=x;
else
x0=x;
end
end
set(handles.edit11,'string',n);
set(handles.edit10,'string',x);
set(handles.edit12,'String',tol);
end

% --- Executes on button press in pb_tabla2.


function pb_tabla2_Callback(hObject, eventdata, handles)
syms x
funcion=get(handles.edit1h,'string');
f=inline(funcion);
x=-5:0.1:5;
n=length(x);
for i=1:n
y(i)=f(x(i));
end
j=-5;
for i=1:11
text(j,0,num2str(j));
j=j+1;
end
a=str2double(get(handles.xl,'string'));
b=str2double(get(handles.xu,'string'));
iteraciones=1;
j=1;
pmviejo=0;
while iteraciones<8
pm=((a+b)/2);
fa=f(a);
fb=f(b);
fpm=f(pm);
aa(j)=a;
bb(j)=b;
ppm(j)=pm;
ffa(j)=fa;
ffb(j)=fb;
ffpm(j)=fpm;
errorf=abs((pm-pmviejo)/pm);
err(j)=errorf;
if fa*fpm<0
b=pm;
end
if fa*fpm>0
a=pm;
end
pmviejo=pm;
j=j+1;
iteraciones=iteraciones+1;
end
set(handles.uitable1,'data',[aa' bb' ppm' ffa' ffb' ffpm' err']);

% --- Executes on button press in pb_tabla1.


function pb_tabla1_Callback(hObject, eventdata, handles)
try

funcion=get(handles.edit1h,'string');
x0=str2double(get(handles.edit2vi,'string'));
Tol=str2double(get(handles.edit3tol,'string'));
syms x
iteracion=0;
errorCalculado=100;
f=sym(funcion);
derivada=diff(f,x);
set(handles.uitable2,'data',{})
if derivada==0
hold off
cla
set(handles.uitable2,'data',{})
else
while errorCalculado>Tol
fx=subs(f,x0);
dx=subs(derivada,x0);
x1=x0-(fx/dx);
errorCalculado=abs(((x1-x0)/x1)*100);
%mostrar datos en tabla

%valores = {iteracion x0 x1 errorCalculado};


%temp=get(handles.tabla,'data');
%valoresNuevos=[valores;temp];
%set(handles.tabla,'Data',valoresNuevos)

newRow ={iteracion x0 errorCalculado};


oldData = get(handles.uitable2,'data');
newData=[oldData; newRow];
set(handles.uitable2,'data',newData)

x0=x1;
iteracion=iteracion+1;
end
end
catch

% --- Executes on button press in pushbutton13.


function pushbutton13_Callback(hObject, eventdata, handles)
syms x
cf=get(handles.edit1h,'string');
f=inline (cf);
x1=str2double(get(handles.valor3,'String'));
tol=str2double(get(handles.tol3,'String'));
n=0; error=100; d=0.01;
while(error>tol)
n=n+1;
x = x1 - d*x1*f(x1)/(f(x1 + d*x1)-f(x1));
error=abs(((x-x1)/x)*100);
x1 = x;
end
set(handles.ra3,'String',x);
set(handles.iter3,'String',n);
set(handles.er3,'String',tol);

% --- Executes on button press in pb_grafica3.


function pb_grafica3_Callback(hObject, eventdata, handles)
axes(handles.axes3);
x=str2double(get(handles.ra3,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');
% --- Executes on button press in pb_tabla3.
function pb_tabla3_Callback(hObject, eventdata, handles)
f=get(handles.edit1h,'string');
x0=str2double(get(handles.vi3,'string'));
x1=str2double(get(handles.valor3,'string'));
tol=str2double(get(handles.tol3,'string'));
syms x;
ea(1)=100;
set(handles.uitable3,'data',{})
hold off
cla
set(handles.uitable3,'Data',{})
%set(handles.respuesta,'string','no hay raiz');
i=1;
while abs(ea)>tol;
x=x0;
g=eval(f);
x=x1;
gg=eval(f);
xi=x1-((gg*(x0-x1))/(g-gg));
ea=abs((xi-x1)/xi)*100;
x0=x1;
x1=xi;
%mostrara datos en tabla
newRow ={i,x xi,ea};
oldData = get(handles.uitable3,'data');
newData=[oldData; newRow];
set(handles.uitable3,'data',newData)
i=i+1;
end

function ra3_Callback(hObject, eventdata, handles)

% --- Executes on button press in pushbutton10.


function pushbutton10_Callback(hObject, eventdata, handles)
syms x
cf=get(handles.edit1h,'string');
f=inline(cf);
dg=diff(cf,x);
df=inline(dg);
x=str2double(get(handles.edit2vi,'String'));
tol=str2double(get(handles.edit3tol,'String'));
n=0; error=100;
while(error>tol)
xa=x;
x=x-f(x)/df(x);
error=abs(((x-xa)/x)*100);
error=double(error);
x = double(x);
n=n+1;
end
set(handles.ra,'String',x);
set(handles.iter,'String',n);
set(handles.er,'String',error);

syms x
def=get(handles.edit1h,'string');
f=inline(def);
x0=str2double(get(handles.xl,'string'));
x1=str2double(get(handles.xu,'string'));
tol=str2double(get(handles.tol2,'string'));
n=0;
if f(x0)*f(x1)<0
x=x0;
while abs(f(x))>tol
x=(x0+x1)/2;
n=n+1;
if f(x0)*f(x)<0
x1=x;
else
x0=x;
end
end
set(handles.edit11,'string',n);
set(handles.edit10,'string',x);
set(handles.edit12,'String',tol);
end

syms x
cf=get(handles.edit1h,'string');
f=inline (cf);
x1=str2double(get(handles.valor3,'String'));
tol=str2double(get(handles.tol3,'String'));
n=0; error=100; d=0.01;
while(error>tol)
n=n+1;
x = x1 - d*x1*f(x1)/(f(x1 + d*x1)-f(x1));
error=abs(((x-x1)/x)*100);
x1 = x;
end
set(handles.ra3,'String',x);
set(handles.iter3,'String',n);
set(handles.er3,'String',tol);

% --- Executes on button press in pushbutton11.


function pushbutton11_Callback(hObject, eventdata, handles)
try
funcion=get(handles.edit1h,'string');
x0=str2double(get(handles.edit2vi,'string'));
Tol=str2double(get(handles.edit3tol,'string'));
syms x
iteracion=0;
errorCalculado=100;
f=sym(funcion);
derivada=diff(f,x);
set(handles.uitable2,'data',{})
if derivada==0
hold off
cla
set(handles.uitable2,'data',{})
else
while errorCalculado>Tol
fx=subs(f,x0);
dx=subs(derivada,x0);
x1=x0-(fx/dx);
errorCalculado=abs(((x1-x0)/x1)*100)
newRow ={iteracion x0 errorCalculado};
oldData = get(handles.uitable2,'data');
newData=[oldData; newRow];
set(handles.uitable2,'data',newData)

x0=x1;
iteracion=iteracion+1;
end
end
catch
% msgbox('Un error ha ocurrido. Verifique que ha introducido todos
los datos y de la forma adecuada','Error','error')
end

syms x
funcion=get(handles.edit1h,'string');
f=inline(funcion);
x=-5:0.1:5;
n=length(x);
for i=1:n
y(i)=f(x(i));
end
j=-5;
for i=1:11
text(j,0,num2str(j));
j=j+1;
end
a=str2double(get(handles.xl,'string'));
b=str2double(get(handles.xu,'string'));
iteraciones=1;
j=1;
pmviejo=0;
while iteraciones<8
pm=((a+b)/2);
fa=f(a);
fb=f(b);
fpm=f(pm);
aa(j)=a;
bb(j)=b;
ppm(j)=pm;
ffa(j)=fa;
ffb(j)=fb;
ffpm(j)=fpm;
errorf=abs((pm-pmviejo)/pm);
err(j)=errorf;
if fa*fpm<0
b=pm;
end
if fa*fpm>0
a=pm;
end
pmviejo=pm;
j=j+1;
iteraciones=iteraciones+1;
end
set(handles.uitable1,'data',[aa' bb' ppm' ffa' ffb' ffpm' err']);
f=get(handles.edit1h,'string');
x0=str2double(get(handles.vi3,'string'));
x1=str2double(get(handles.valor3,'string'));
tol=str2double(get(handles.tol3,'string'));
syms x;
ea(1)=100;
set(handles.uitable3,'data',{})
hold off
cla
set(handles.uitable3,'Data',{})
%set(handles.respuesta,'string','no hay raiz');
i=1;
while abs(ea)>tol;
x=x0;
g=eval(f);
x=x1;
gg=eval(f);
xi=x1-((gg*(x0-x1))/(g-gg));
ea=abs((xi-x1)/xi)*100;
x0=x1;
x1=xi;
%mostrara datos en tabla
newRow ={i,x xi,ea};
oldData = get(handles.uitable3,'data');
newData=[oldData; newRow];
set(handles.uitable3,'data',newData)
i=i+1;
end

% --- Executes on button press in pushbutton12.


function pushbutton12_Callback(hObject, eventdata, handles)
axes(handles.axes2);
x=str2double(get(handles.ra,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');

axes(handles.axes1);
x=str2double(get(handles.edit10,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');

axes(handles.axes3);
x=str2double(get(handles.ra3,'String'));
fx=get(handles.edit1h,'String');
hold off
ezplot (fx);
hold on
grid on
zoom on
plot (x,subs(fx,x),'or');

S-ar putea să vă placă și