Info

This question is closed. Reopen it to edit or answer.

matrix dimensions must agree

1 view (last 30 days)
Mark Foster
Mark Foster on 31 Mar 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
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 Comments
Michael Haderlein
Michael Haderlein on 31 Mar 2015
Edited: Michael Haderlein on 31 Mar 2015
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.
Edric Ellis
Edric Ellis on 31 Mar 2015
FYI: I removed the duplicate question.

Answers (1)

Torsten
Torsten on 31 Mar 2015
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 Comment
Michael Haderlein
Michael Haderlein on 31 Mar 2015
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.

Tags

No tags entered yet.

Products

Community Treasure Hunt

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

Start Hunting!