matrix dimensions must agree

I am trying to calculate the max temperature after individual time periods incremented in 1seconds (t_actuation_sC_r) but it will not work, it only calculates the max temp if i make the time a single number. any ideas why it won't work?
the D is a data file on my computer don't think its necessary to put in
t_actuation_sC_r=linspace(1,150,150);
t_max_sC_r=D.T_atm+((0.5*D.I_r*D.w_max^2)/(2*D.c_avg*((pi*(D.ro_r_s)^2)*D.thick_sC_avg)*D.rho_C_avg*(1-exp(-(t_actuation_sC_r*(D.h_C_avg-((2*pi*D.ro_r_s^2)+(pi*2*D.ro_r_s*D.thick_sC_avg))))/(D.c_avg*(((pi*(D.ro_r_s)^2)*D.thick_sC_avg)*D.rho_C_avg))))))

2 个评论

Based on the information you give, it's impossible to say. Please (1) post all the relevant code (please also format it as code with the button above the field in which you enter the question), (2) tell us what is not working (error message? Wrong value? ...?) and (3) tell us what is D (as D seems to be a struct, best you just enter "D" in the command window and give us the output).
Also, please don't post the same question twice.
FYI: I removed the duplicate question.

回答(1 个)

Torsten
Torsten 2015-3-31

0 个投票

Multiplication, division and potentiation of arrays in your case is always componentwise - thus you will have to use .*, ./ and .^ instead of *, / and ^.
Best wishes
Torsten.

1 个评论

Yes, most likely the answer goes in this direction. However, if t_actuation_sC_r is the only array with more than one element, this won't be the error, at least not in the code snipped shown here. t_actuation_sC_r appears only once in the equation and is not powered, thus, * and / should work here. Until we don't know more, all we can do is guessing.

此问题已关闭。

产品

标签

尚未输入任何标签。

关闭:

2021-8-20

Community Treasure Hunt

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

Start Hunting!

Translated by