How to solve this incomplete elliptic equation in Matlab? Thank you!

42 Views Asked by At

I am trying to solve this formula in Matlab $$V= \frac{ 2r_{1}r_{2}^{2}k^{2}}{3}(2 \bullet R_{f} (0,1-k^{2},1) - \frac{1+k^{2}}{3} R_{d}(0,1-k^{2},1)$$ where $k = \frac{r_{1}}{r_{2}}$

I thought it was the code below but when I put the value in it comes out with 1.6296 when I put in $r_{1} = 0.5$ and $r_{2} = 1.5$, I know the answer is 0.5807496. Please help, I don't know what I have done wrong. Thank you so much in advance!

code:

close all


clear all


clc

prompt='Enter r1: ';


r1=input(prompt);


prompt='Enter r2: ';


r2=input(prompt);


k=r1/r2;


for b=1:length(r1)


    for c=1:length(r2)


for y=0:length(1-k.^2)


    Rf=y;


    Rd=y;


v=(2.*Rf-((1+k.^2)/3).*Rd);



plot(v,'LineWidth',2);


    end


        end


    end


display(v);

Thank you!!!