how to Integral function with two independent variables ?

1 visualizzazione (ultimi 30 giorni)
xiaoqian chang il 2 Feb 2021
Risposto: Shubham Rawat il 8 Feb 2021
I need to integrate my function with two variables,and the date is a matrix with two columns，the function is：i=100,and the variables x and y is knowed.
I think maye i shoule use the function integral2,but i dont konw how to deal with the "i"
I try to write some code,maybe is it right? but the bold code ,i don't know how to write
for i=1:100
x=data(:,1);
y=data(:,2);
f=@(x,y)(x/y)(x+y) ;
q = integral2(fun,xmin,xmax,ymin,ymax,Name,Value)
anyone can help me ??
Thank you very much ！
1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Bjorn Gustavsson il 2 Feb 2021
Your problem description is a bit unclear, you'll get better help if you make it clearer.

Accedi per commentare.

Risposte (1)

Shubham Rawat il 8 Feb 2021
Hi,
You are using variables and but your limits are on i. So I am not able to figure out who are the variables which you want to integrate.
You may use summation here instead of using integration. You can use help from the following code:
x=data(:,1);
y=data(:,2);
sum = zeros(100,1);
for i=1:100
sum(i) = (x(i)/y(i))*(x(i) + y(i));
end
Hope this Helps!
0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Categorie

Scopri di più su Numerical Integration and Differentiation in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by