help mee (ideal gas equation in appdesigner)
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Nivedita
on 8 Dec 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 Comments
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!