Filter löschen
Filter löschen

Secant

6 Ansichten (letzte 30 Tage)
Ashley Dunn
Ashley Dunn am 4 Apr. 2011
Beantwortet: Steve Areola am 31 Jul. 2023
Write a Matlab function secant:m which
  2 Kommentare
Matt Tearle
Matt Tearle am 4 Apr. 2011
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 am 4 Apr. 2011
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.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Sean de Wolski
Sean de Wolski am 4 Apr. 2011
secant = @(x)1./cos(x);
  3 Kommentare
Ashley Dunn
Ashley Dunn am 4 Apr. 2011
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 am 4 Apr. 2011
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.

Melden Sie sich an, um zu kommentieren.


Steve Areola
Steve Areola am 31 Jul. 2023
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

Community Treasure Hunt

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

Start Hunting!

Translated by