Defining integration function in matlanb
Show older comments
I want to defin a fuction in matlab. This function is for calculating attached integral.
After defining this function I want to calculate H(T=100) in another m file.I wrote below function but it does not work.
function [H]=enthalpymethod(T)
H=int(Cp,T,[0 T]);
end
Would you please correct me.
Accepted Answer
More Answers (1)
Alan Stevens
on 26 Feb 2022
Like this?
% If Cp is a constant then the integral is just Cp*T
% If it is a function of T, then define the function:
Cp = @(T) 3 + T/100; % Arbitrary function - replace with your true function
H = integral(Cp,0,100);
disp(H)
Categories
Find more on Nonlinear Optimization 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!