How to find the double trapezoidal integral of a function with 3 variables
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
I have a function with 3 variables that I want to find the trapezoidal double integral of. My answer should be dependent on the last variable. I have tried using trapz, but I only get it to work when I give the undefined variable a value. Is there a way to use trapz in matlab, and still have an answer that is dependent on a variable?
Thanks!
Script:
clc; clear all; close all;
syms x
D1 = 0:1:3000;
D2 = 0:1:400;
[d1,d2] = meshgrid(D1,D2);
my_function = (d2./d1).*(x./d1).^(d2-1).*exp(-(x./d1).^d2)+((d2./d1)+d1.^2);
d = trapz(D2,trapz(D1,my_function,2))
0 Kommentare
Antworten (1)
Torsten
am 8 Mai 2015
You can loop over a specified x-range, but you will not be able to get an expression for your integral as a function of x by the use of trapz.
Best wishes
Torsten.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation 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!