Azzera filtri
Azzera filtri

How to perform iteration calculations

1 visualizzazione (ultimi 30 giorni)
dj
dj il 18 Ott 2014
Commentato: dj il 18 Ott 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!

Risposta accettata

Matt J
Matt J il 18 Ott 2014
Modificato: Matt J il 18 Ott 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 Commenti
Matt J
Matt J il 18 Ott 2014
Modificato: Matt J il 18 Ott 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 il 18 Ott 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!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by