Matrix dimensions must agree
Ältere Kommentare anzeigen
Hi,
i try to write this little program to have a simplified analysis for the mass of pressurizing Gas in two case: isothermal and isentropic. I used many prompt to insert the inputs and, as shown down, an if cicle. However it works just when i write 'isotermico' as input for the prompt4. If i write 'isoentropico' occurs and error:
Matrix dimensions must agree.
Error in
analisi_semplificata_massa_gas_pressurizzante
(line 52)
if Caso == 'isotermico'
I understand that the problem is the differnt length of the words 'isotermico' and 'isoentropico', in fact if i write 'isoentropi' it works, but i'd like to know how to write it correctly without this ignorant ploy.
prompt4 = 'Caso: '; % INSERIRE CASO (Es.: isotermico, isoentropico);
Caso = input(prompt4,'s');
prompt5 = 'Inserire pressione serbatoio gas: '
P_0 = input(prompt5)
prompt6 = 'Inserire pressione finale del propellente nel serbatoio: '
P_p = input(prompt6)
prompt7 = 'Inserire valore della temperatura nel serbatoio: '
T_0 = input(prompt7);
if Caso == 'isotermico'
V_0 = (V_p*P_p)/(P_0-P_p)
elseif Caso == 'isoentropico'
prompt8 = 'Inserire valore di k: '
k = input(prompt8);
V_0 = V_p/(((P_0/P_p)^(1/k))-1)
else
display('Inserire funzione nello script')
end
m_0 = P_0*V_0/(R*T_0)
Summing:
I need to know how to write correctly the condition of the if cicle without any errors occurring due to the different length of the two text array 'isotermico' and 'isoentropic'.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Text Data Preparation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!