How to perform iteration calculations

1 次查看(过去 30 天)
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!

采纳的回答

Matt J
Matt J 2014-10-18
编辑:Matt J 2014-10-18
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 个评论
Matt J
Matt J 2014-10-18
编辑:Matt J 2014-10-18
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 2014-10-18
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!

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by