Effacer les filtres
Effacer les filtres

How to perform iteration calculations

1 vue (au cours des 30 derniers jours)
dj
dj le 18 Oct 2014
Commenté : dj le 18 Oct 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!

Réponse acceptée

Matt J
Matt J le 18 Oct 2014
Modifié(e) : Matt J le 18 Oct 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 commentaires
Matt J
Matt J le 18 Oct 2014
Modifié(e) : Matt J le 18 Oct 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 le 18 Oct 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!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Line Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by