please help with Managing data and solving

Cof=[38.91 3.904e-2 -3.105e-5 8.606e-9;48.50 9.188e-2 -8.540e-5 32.40e-9;29.10 1.158e-2 -0.6076e-5 1.311e-9;29.00 0.2199e-2 -0.5723e-5 -2.871e-9];
j=1;
fprintf('\n\n')
disp(' Temperature(deg C) Cpso2 Cpso3 Cpo2 CpN2')
t=200:20:400;
T(j)=t
fprintf('%6.3f \n',T(j));
i=1:1:4;
Cp(j)=Cof(i,1)+Cof(i,2)*T(j)+Cof(i,3)*(T(j))^2+Cof(i,4)*(T(j))^3;
fprintf('%6.3f\n',Cp(j));
i=j+1
Hi I keep getting this error code = In an assignment A(I) = B, the number of elements in B and I must be the same. how can I solve this error, thanks for the help

댓글 수: 1

Matt J
Matt J 2013년 7월 12일
It would help us a lot if you would use the '{} Code' menu tool to format your code. So far, I've been doing that for you.
It would also help if you copy/paste your error messages so we can see what statement is causing them.

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2013년 7월 12일
편집: Matt J 2013년 7월 12일

0 개 추천

T(j)=t
won't work because T(j) is a 1x1 location whereas t is 1x11.

댓글 수: 5

jessica
jessica 2013년 7월 12일
ok thanks for you help, you are very kind, I made j=1:1:11, I am still working on getting Cp(j) information on the table, are there any tips you can provide me?
Matt J
Matt J 2013년 7월 12일
I really don't know the purpose of the code or what you expect its output to be. You should describe what you expect and what you're getting instead.
jessica
jessica 2013년 7월 13일
편집: Matt J 2013년 7월 13일
I have to calculate the heat capacity of each gas Cpso2 Cpso3 Cpo2 CpN2 between 200 and 400 degrees and create an 11x5 matrix where the first column is the temperature and the others the heat capacities, they provide the values of Cof and the equation c=a+bT+cT^2+dT^3.
a= the first column of Cof
b=the second column of Cof
c= the third column of Cof
d=the fourth column of Cof
I keep having a problem with the multiplication between matrixes and I only get the values of the temperature the gases I can't figure out, thank you so much
Something like this, maybe
t=(200:20:400).';
Tpowers=bsxfun(@power,t,(0:3));
Table=[ t, Tpowers*Cof.' ];
fprintf('%6.3f %6.3f %6.3f %6.3f %6.3f \n', Table.')
jessica
jessica 2013년 7월 13일
thank you so much, I was trying to do it in a more complicated way, the simpler the better

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2013년 7월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by