help mee (ideal gas equation in appdesigner)
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
global t V1 V2
syms V t V1 V2
F=str2sym('P=1*8.314*t/V');
W=int(F,V,V1,V2);
conv=arrayfun(@char,W,'uniform',0);
conv=cell2mat(conv);
app.resultadoEditField=conv;
global t
value = app.tempEditField.Value;
t=value;
end
% Value changed function: v1EditField
function v1EditFieldValueChanged(app, event)
global V1
value = app.v1EditField.Value;
V1=value;
end
% Value changed function: v2EditField
function v2EditFieldValueChanged(app, event)
global V2
value = app.v2EditField.Value;
V2=value;
error
Error using symengine
Invalid integrand.
rSym = mupadmex('symobj::intdef',f.s,x.s,a.s,b.s,options);
0 Kommentare
Antworten (1)
Nivedita
am 8 Dez. 2023
Hello Bruno,
I understand that you are encountering is due to an invalid integrand being passed to the "int" function. This usually happens when the expression to be integrated is not properly defined or when the symbolic variables involved are not correctly initialized.
In your MATLAB code, you are trying to integrate the function "F" with respect to "V" from "V1" to "V2". The function "F" is defined as "P = 1*8.314*t/V". However, there's an issue with the way you've defined "F". You've used "str2sym" to convert a string to a symbolic expression, but you've included "P=" in the string, which is not necessary and could be causing the problem.
Here's how you can correct the code:
% Define the symbolic variables
syms V t V1 V2
% Define the function F to integrate (removed 'P=')
F = 1 * 8.314 * t / V;
% Perform the integration with respect to V from V1 to V2
W = int(F, V, V1, V2);
% Convert the symbolic expression to a string
conv = char(W);
I hope this helps!
Regards,
Nivedita.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!