How can I multiply two matrices of difference size

2 ビュー (過去 30 日間)
Javier Joya
Javier Joya 2016 年 6 月 22 日
コメント済み: Javier Joya 2016 年 6 月 23 日
I am trying to do some analysis from excel spreadsheets. The following information is the columns I get after importing the data into matlab. The total number of rows is 1647.
Time = data(:,1); (1647x1)
Temp_C = data(:,2); (1647x1)
dmdt = data(:,3); (1647x1)
Now, the following is what I started doing and so far, it worked well.
Temp_K = (Temp_C + 273.15); (1647x1)
dMdT = dmdt/1e6; (1647x1)
**(a) and (MM) is input information from the user >>> constant numbers
My issue is the following lines:
q = (dMdT)*(1/a); (1647x1)
w = [Temp_K/M1]; (1647x1)
v = q*(sqrt((w)));
Pressure = exp(34.146-(10830/Temp_K));
temp = (1/(Temp_K));
k_value_slope = (Pressure/v);
When I try to get the values for v, I understand since they are not the same dimension, matlab cannot perform the operation. Is there any trick or function I may use to do this? The matrix I am expecting to get for v is also a (1647x1). Also, for Pressure, I get values that are not correct. Not sure if is because Temp_K is also a vector (1647x1) and I am trying to get a (1647x1) matrix for Pressure. For (temp) I get zero values all across the board and I don't understand how can this be even possible since all I am trying to find is the reciprocal of Temp_K. Lastly, for (k_value_slope), I get a (1647x1647) matrix and again, I am expecting to a (1647x1).
I will greatly appreciate any help or feedback that may lead me in the right direction. I have tried using the "transpose, ', " function and the "reshape" but no luck thus far.

採用された回答

James Tursa
James Tursa 2016 年 6 月 22 日
編集済み: James Tursa 2016 年 6 月 22 日
Use the "dot" version of the operators to do element-wise multiplication and division. E.g.
v = q .* (sqrt((w)));
Pressure = exp(34.146-(10830 ./ Temp_K));
temp = (1 ./ (Temp_K));
k_value_slope = (Pressure ./ v);
  1 件のコメント
Javier Joya
Javier Joya 2016 年 6 月 23 日
Thank you very much!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import from MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by