Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

hello)) I'm quite new in matlab and I try to solve integral which have variables from matrices.

1 Ansicht (letzte 30 Tage)
For example my integral looks like this
INTEGRAL(V.*(1-x./I).^(0.5), x, 0, I) So I have to take integral for x from 0 to I, where V and I are matrices with the size of NxM, BUT the most important I just have to take NxM integrals
INTEGRAL(V(i,j).*(1-x./I(i,j)).^(0.5), x, 0, I(i,j)) and in the end to get matrix NxM of integrals.
I tried
time2=@(Id, I, vp, a) (1./(vp.*(1-Id./I).^(a+1)).^(0.5));
time = zeros(size(vp));
for j=1:size1
for k=1:size2
time3=integral(@(Id)time2(Id, I(j,k), vp(j,k), a),0,I(j,k));
end
time(j,k)=time3;
end
but the message There may be a singularity, or the tolerances may be too tight for this problem. and my results unnormal
also I tried
time3 = arrayfun(@(I, vp) integral(@(Id)(1./(vp.*(1-Id./I).^(a+1)).^(0.5)),0,I), I, vp);
and I got my matrix but with non expected value and a message
Minimum step size reached near x = 0.293275. There may be a singularity, or the tolerances may be too tight for this problem.
  1 Kommentar
Marine
Marine am 27 Okt. 2018
Bearbeitet: Marine am 27 Okt. 2018
I've got it))
fun=@(Id, vp, I, a) 1./(vp.*(1-(Id./I).^(a+1)).^(0.5));
fun2 = @(I,vp)integral(@(Id)fun(Id, vp, I, a),0,I);
time3 =@(I,vp)arrayfun(fun2,I,vp);

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by