PREGUNTA 01:
clc
clear
x=[-3:0.01:5]
y=x.^3;
y1=x.^2-5;
plot(x,y,'r','linewidth',2)
hold on
plot(x,y1,'b','linewidth',2)
grid on
hold off
140
140
120
120
100
100
80
80
60
60
40
40
20
20
00
-20
-20
-40
-40
-3
-3 -2
-2 -1
-1 00 11 22 33 44 55
function y=fbis1(x)
y=x^3-x^2+5;
end
>> format long
>> a=-2, b=-1, tolerancia=10^(-6)
a=
-2
b=
-1
tolerancia =
1.000000000000000e-06
>> [c] = bisec('fbis1',a,b,tolerancia)
0 -2.00000000000 -1.00000000000 -1.50000000000 -0.62500000000
1 -1.50000000000 -1.00000000000 -1.25000000000 1.48437500000
2 -1.50000000000 -1.25000000000 -1.37500000000 0.50976562500
3 -1.50000000000 -1.37500000000 -1.43750000000 -0.03686523438
4 -1.43750000000 -1.37500000000 -1.40625000000 0.24154663086
5 -1.43750000000 -1.40625000000 -1.42187500000 0.10362625122
6 -1.43750000000 -1.42187500000 -1.42968750000 0.03370332718
7 -1.43750000000 -1.42968750000 -1.43359375000 -0.00150007010
8 -1.43359375000 -1.42968750000 -1.43164062500 0.01612182707
9 -1.43359375000 -1.43164062500 -1.43261718750 0.00731593091
10 -1.43359375000 -1.43261718750 -1.43310546875 0.00290919386
11 -1.43359375000 -1.43310546875 -1.43334960938 0.00070487779
12 -1.43359375000 -1.43334960938 -1.43347167969 -0.00039751717
13 -1.43347167969 -1.43334960938 -1.43341064453 0.00015370006
14 -1.43347167969 -1.43341064453 -1.43344116211 -0.00012190362
15 -1.43344116211 -1.43341064453 -1.43342590332 0.00001589945
16 -1.43344116211 -1.43342590332 -1.43343353271 -0.00005300178
17 -1.43343353271 -1.43342590332 -1.43342971802 -0.00001855108
18 -1.43342971802 -1.43342590332 -1.43342781067 -0.00000132580
19 -1.43342781067 -1.43342590332 -1.43342685699 0.00000728683
c=
-1.433426856994629
PREGUNTA 02:
clc
clear
x=[-3:0.01:5]
y=4*cos(x);
y1=10-2*x.^2;
plot(x,y,'r','linewidth',2)
hold on
plot(x,y1,'b','linewidth',2)
grid on
hold off
10
-5
-10
-15
-20
-25
-30
-35
-40
-3 -2 -1 0 1 2 3 4 5
function y=fbis2(x)
y=4*cos(x)+2*x^2-10;
end
>> a=-3, b=-2, tolerancia=10^(-6)
a=
-3
b=
-2
tolerancia =
1.000000000000000e-06
>> [c] = bisec('fbis2',a,b,tolerancia)
0 -3.00000000000 -2.00000000000 -2.50000000000 -0.70457446219
1 -3.00000000000 -2.50000000000 -2.75000000000 1.42779048547
2 -2.75000000000 -2.50000000000 -2.62500000000 0.30322127414
3 -2.62500000000 -2.50000000000 -2.56250000000 -0.21502571231
4 -2.62500000000 -2.56250000000 -2.59375000000 0.04047750613
5 -2.59375000000 -2.56250000000 -2.57812500000 -0.08817517284
6 -2.59375000000 -2.57812500000 -2.58593750000 -0.02407460859
7 -2.59375000000 -2.58593750000 -2.58984375000 0.00814494218
8 -2.58984375000 -2.58593750000 -2.58789062500 -0.00797895203
9 -2.58984375000 -2.58789062500 -2.58886718750 0.00007946439
10 -2.58886718750 -2.58789062500 -2.58837890625 -0.00395062637
11 -2.58886718750 -2.58837890625 -2.58862304688 -0.00193580165
12 -2.58886718750 -2.58862304688 -2.58874511719 -0.00092822380
13 -2.58886718750 -2.58874511719 -2.58880615234 -0.00042439350
14 -2.58886718750 -2.58880615234 -2.58883666992 -0.00017246800
15 -2.58886718750 -2.58883666992 -2.58885192871 -0.00004650267
16 -2.58886718750 -2.58885192871 -2.58885955811 0.00001648064
17 -2.58885955811 -2.58885192871 -2.58885574341 -0.00001501107
18 -2.58885955811 -2.58885574341 -2.58885765076 0.00000073477
19 -2.58885765076 -2.58885574341 -2.58885669708 -0.00000713815
c=
-2.588856697082520
PREGUNTA 03:
clc
clear
x=[-3:0.01:5]
y=x.^3;
y1=40./(x.^2+2);
plot(x,y,'r','linewidth',2)
hold on
plot(x,y1,'b','linewidth',2)
grid on
hold off
140
120
100
80
60
40
20
-20
-40
-3 -2 -1 0 1 2 3 4 5
function y=fbis3(x)
y=x^3-40/(x^2+2);
end
>> a=1, b=2, tolerancia=10^(-6)
a=
b=
tolerancia =
1.000000000000000e-06
>> [c] = bisec('fbis3',a,b,tolerancia)
0 1.00000000000 2.00000000000 1.50000000000 -6.03676470588
1 1.50000000000 2.00000000000 1.75000000000 -2.54185956790
2 1.75000000000 2.00000000000 1.87500000000 -0.66032777089
3 1.87500000000 2.00000000000 1.93750000000 0.32139430982
4 1.87500000000 1.93750000000 1.90625000000 -0.17310693364
5 1.90625000000 1.93750000000 1.92187500000 0.07321653051
6 1.90625000000 1.92187500000 1.91406250000 -0.05017485169
7 1.91406250000 1.92187500000 1.91796875000 0.01146315951
8 1.91406250000 1.91796875000 1.91601562500 -0.01937023264
9 1.91601562500 1.91796875000 1.91699218750 -0.00395713738
10 1.91699218750 1.91796875000 1.91748046875 0.00375211034
11 1.91699218750 1.91748046875 1.91723632813 -0.00010273864
12 1.91723632813 1.91748046875 1.91735839844 0.00182462956
13 1.91723632813 1.91735839844 1.91729736328 0.00086093139
14 1.91723632813 1.91729736328 1.91726684570 0.00037909286
15 1.91723632813 1.91726684570 1.91725158691 0.00013817623
16 1.91723632813 1.91725158691 1.91724395752 0.00001771858
17 1.91723632813 1.91724395752 1.91724014282 -0.00004251008
18 1.91724014282 1.91724395752 1.91724205017 -0.00001239577
19 1.91724205017 1.91724395752 1.91724300385 0.00000266140
c=
1.917243003845215
PREGUNTA 04:
clc
clear
x=[-3:0.01:5]
y=exp(-x/2);
y1=abs(1-x);
plot(x,y,'r','linewidth',2)
hold on
plot(x,y1,'b','linewidth',2)
grid on
hold off
4.5
3.5
2.5
1.5
0.5
0
-3 -2 -1 0 1 2 3 4 5
function y=fbis4(x)
y=exp(-x/2)-abs(1-x);
end
>> a=-3, b=-2, tolerancia=10^(-6)
a=
-3
b=
-2
tolerancia =
1.000000000000000e-06
>> [c] = bisec('fbis4',a,b,tolerancia)
0 -3.00000000000 -2.00000000000 -2.50000000000 -0.00965704254
1 -3.00000000000 -2.50000000000 -2.75000000000 0.20507672292
2 -2.75000000000 -2.50000000000 -2.62500000000 0.09045073794
3 -2.62500000000 -2.50000000000 -2.56250000000 0.03863833627
4 -2.56250000000 -2.50000000000 -2.53125000000 0.01405786122
5 -2.53125000000 -2.50000000000 -2.51562500000 0.00209305656
6 -2.51562500000 -2.50000000000 -2.50781250000 -0.00380872645
7 -2.51562500000 -2.50781250000 -2.51171875000 -0.00086453137
8 -2.51562500000 -2.51171875000 -2.51367187500 0.00061258685
9 -2.51367187500 -2.51171875000 -2.51269531250 -0.00012639099
10 -2.51367187500 -2.51269531250 -2.51318359375 0.00024299322
11 -2.51318359375 -2.51269531250 -2.51293945313 0.00005827494
12 -2.51293945313 -2.51269531250 -2.51281738281 -0.00003406457
13 -2.51293945313 -2.51281738281 -2.51287841797 0.00001210355
14 -2.51287841797 -2.51281738281 -2.51284790039 -0.00001098091
15 -2.51287841797 -2.51284790039 -2.51286315918 0.00000056122
16 -2.51286315918 -2.51284790039 -2.51285552979 -0.00000520987
17 -2.51286315918 -2.51285552979 -2.51285934448 -0.00000232433
18 -2.51286315918 -2.51285934448 -2.51286125183 -0.00000088156
19 -2.51286315918 -2.51286125183 -2.51286220551 -0.00000016017
c=
-2.512862205505371
>>
PREGUNTA 05:
clc
clear
x=[-3:0.01:5]
y=x.^2;
y1=log(x.^2+x+2);
plot(x,y,'r','linewidth',2)
hold on
plot(x,y1,'b','linewidth',2)
grid on
hold off
25
20
15
10
0
-3 -2 -1 0 1 2 3 4 5
function y=fbis5(x)
y=x.^2-log(x.^2+x+2);
end
>> a=-1, b=0, tolerancia=10^(-6)
a=
-1
b=
tolerancia =
1.000000000000000e-06
>> [c] = bisec('fbis5',a,b,tolerancia)
0 -1.00000000000 0.00000000000 -0.50000000000 -0.30961578794
1 -1.00000000000 -0.50000000000 -0.75000000000 -0.03220710775
2 -1.00000000000 -0.75000000000 -0.87500000000 0.12871753776
3 -0.87500000000 -0.75000000000 -0.81250000000 0.04623830599
4 -0.81250000000 -0.75000000000 -0.78125000000 0.00652666566
5 -0.78125000000 -0.75000000000 -0.76562500000 -0.01296066020
6 -0.78125000000 -0.76562500000 -0.77343750000 -0.00324732565
7 -0.78125000000 -0.77343750000 -0.77734375000 0.00163206007
8 -0.77734375000 -0.77343750000 -0.77539062500 -0.00080953177
9 -0.77734375000 -0.77539062500 -0.77636718750 0.00041078897
10 -0.77636718750 -0.77539062500 -0.77587890625 -0.00019949014
11 -0.77636718750 -0.77587890625 -0.77612304688 0.00010561972
12 -0.77612304688 -0.77587890625 -0.77600097656 -0.00004694263
13 -0.77612304688 -0.77600097656 -0.77606201172 0.00002933669
14 -0.77606201172 -0.77600097656 -0.77603149414 -0.00000880343
15 -0.77606201172 -0.77603149414 -0.77604675293 0.00001026651
16 -0.77604675293 -0.77603149414 -0.77603912354 0.00000073151
17 -0.77603912354 -0.77603149414 -0.77603530884 -0.00000403597
18 -0.77603912354 -0.77603530884 -0.77603721619 -0.00000165223
19 -0.77603912354 -0.77603721619 -0.77603816986 -0.00000046036
c=
-0.776038169860840
>>