필터 지우기
필터 지우기

how can I use my function f to replace a and b with writing all the equation every time? x^3 + a^2*x^2 - 10)*sin(x) - y) like f(a)*f(b)<0

조회 수: 2 (최근 30일)
clc;
clear;
syms p;
x = 13.61015;
y = 13257;
a = 5.14;
b = 11.47;
err1 = 0.000001;
f = (x^3 + p^2*x^2 - 10)*sin(x) - y == 0;
i=0;
if ((x^3 + a^2*x^2 - 10)*sin(x) - y) * ((x^3 + b^2*x^2 - 10)*sin(x) - y) > 0
disp ('Wrong Interval');
return
end

채택된 답변

Torsten
Torsten 2022년 10월 31일
x = 13.61015;
y = 13257;
a = 5.14;
b = 11.47;
err1 = 0.000001;
f = @(x,y,p) (x^3 + p^2*x^2 - 10)*sin(x) - y ;
f(x,y,a)
ans = -6.8568e+03
f(x,y,b)
ans = 9.9765e+03
  댓글 수: 2
Torsten
Torsten 2022년 10월 31일
편집: Torsten 2022년 10월 31일
So you have two points a, b with f(a)*f(b) < 0.
Now you will form c = (a+b)/2 and calculate f(a)*f(c) and f(b)*f(c).
If f(a)*f(c) < 0, you will set a = a and b = c.
If f(b)*f(c) < 0, you will set a = c and b = b.
And continue in the same way for the next step.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by