Filter löschen
Filter löschen

How to perform iteration calculations

1 Ansicht (letzte 30 Tage)
dj
dj am 18 Okt. 2014
Kommentiert: dj am 18 Okt. 2014
If we are given a set of data and we know that (Tx-T9)/(T1-T9) = cosh[m(L-x)]/cosh(mL), where the only unknown is m, how could we do the iteration calculations on Matlab?
Can we simply solve for m or is the iteration process necessary? We are assuming that m is initially equal to 7.4 m^-1. I tried using Excel for iteration calculations, but I couldn't obtain the value for m for the last 3 temperatures.
Thank you for your help!

Akzeptierte Antwort

Matt J
Matt J am 18 Okt. 2014
Bearbeitet: Matt J am 18 Okt. 2014
You can use fzero,
fun=@(m) norm((Tx-T9)./(T1-T9) - cosh(m(L-x))./cosh(mL));
m = fzero(fun,m0);
Here m0=7.4 is your initial guess. You could also plot the function and look for an approximate root graphically.
  3 Kommentare
Matt J
Matt J am 18 Okt. 2014
Bearbeitet: Matt J am 18 Okt. 2014
Sorry, I thought x was a vector of data, in which case you would use fminsearch instead of fzero. But since all data are scalars, you can do as follows,
L = 0.35; T9 = 27.4; T1 = 49.7; Tx = 42.5; x = 0.05; m0 = 7.4;
A=(Tx-T9)./(T1-T9); %pre-compute to conserve computation
B=L-x;
fun=@(m) A- cosh(m*B)./cosh(m*L);
[m,fval] = fzero(fun,m0)
from which I get the result
m =
7.8930
fval =
0
dj
dj am 18 Okt. 2014
x was a vector of data (x1, ...xn), but I just decided to type in values one by one 'cause I didn't know how to calculate all of the values at the same time, haha. I was wondering why I couldn't get a nice enough answer, but I realized that I was using the wrong values for T9. Thank you so much!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by