how can i do Trapezoidal rule? - error
Show older comments
clc
clear
format long
d = [0.05 0.025 0.0125 0.00625 0.003125];
syms x y
f= 10000.*exp(y)/(1+abs(x)./2) ;
I_t_x = int(f,x,-5,0);
I_t = double(int(I_t_x,y,-2,2))
for i = 1:length(d)
x = -5 : d(i) : 0 ;
y = -2 : d(i) : 2 ;
[X,Y] = meshgrid(x,y);
F = 10000*exp(y)/(1+abs(x)/2) ;
I = trapz(y,trapz(x,F,2))
end
2 Comments
Jan
on 25 May 2021
Please post code as text, because then it can be reused easily to write an answer.
Whenever you mention an error in the forum, post a complete copy of the message. Then the readers can concentrate on solving the problem, instead on investing time in guessing, what the error is. You do have this important information on the screen already, so sharing it is the way to go.
jeaho jang
on 25 May 2021
Accepted Answer
More Answers (0)
Categories
Find more on Loops and Conditional Statements 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!