필터 지우기
필터 지우기

Secant

조회 수: 6 (최근 30일)
Ashley Dunn
Ashley Dunn 2011년 4월 4일
답변: Steve Areola 2023년 7월 31일
Write a Matlab function secant:m which
  댓글 수: 2
Matt Tearle
Matt Tearle 2011년 4월 4일
which...?
I'm going to take a guess that you've been asked to write a function that implements the secant method for finding roots. So what have you done so far (ie please post your code, as appropriate), and what MATLAB-specific issues are you having?
Jan
Jan 2011년 4월 4일
I'm not able to see the entire question. I see: "Write a Matlab function secant:m which". To be exact: This is not even a question at all.

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

답변 (2개)

Sean de Wolski
Sean de Wolski 2011년 4월 4일
secant = @(x)1./cos(x);
  댓글 수: 3
Ashley Dunn
Ashley Dunn 2011년 4월 4일
Hey guys r u able to see the entire question? It's not the secant=cos^-1
It's the secant function which is a complicated equation....
John D'Errico
John D'Errico 2011년 4월 4일
Homework is for YOU to do, for YOU to learn from. We already know how to do it. (And it is not THAT complex of a problem.) So sit down, and make an effort.

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


Steve Areola
Steve Areola 2023년 7월 31일
clc
p0 = 0; p1 = 1; tol = 10^-6; N=12;
i = 2;
f = @(x) %write function;
q0 = f(p0); q1 = f(p1);
while i<=N
p = p1- (q1*(p1-p0))/(q1-q0);
if abs(p-p1)<tol
return
end
i = i+1
p0 = p1
p1 = p
q0 = q1
q1 = f(p)
end

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by