菜鸟慢慢飞吧 关注:35贴子:1,174
  • 5回复贴,共1
clear
o1=150;
o2=2000;
o=0;
k=0;
num1=fun(o1,v);
num2=fun(o2,v);
for v=0.05:0.05:0.95
for k=1:1000000000
o=(o1+o2)/2;
if (num1*num2<0)
o2=o;
else
o1=o;
end
end
if o2-o1<0.000000001
disp(o),break,end
end


1楼2015-06-09 11:23回复
    function y=fun(x,v)
    A=2.311;
    t=1.703;
    o1=2000;
    o2=150;
    y=v*(o1^(1/t)-x^(1/t)/(o1^(1/t)+A*x^(1/t))+(1-v)*(o2^(1/t)-x^(1/t)/(o2^(1/t)+A*x^(1/t));


    2楼2015-06-09 11:23
    回复
      clear
      for i=0.05:0.05:0.95;
      a=150;
      b=2000;
      k=0;
      c=0;
      d=[];
      for k=1:10000000000000000000
      c=0.5*(a+b);
      if fun(a,i)*fun(c,i)<0
      b=c;
      else
      a=c;
      end
      if b-a<0.000000001,break,end
      end
      disp(c);
      d=[d c];
      end
      plot(d,0.05:0.05:0.95);


      3楼2015-06-09 11:29
      回复

        unction y=fun(x,a)
        m=2000;
        t=1.703;
        c=2.311;
        n=150;
        y=a*(m^(1/t)-x^(1/t))/(m^(1/t)+c*x^(1/t))+(1-a)*(n^(1/t)-x^(1/t))/(n^(1/t)+c*x^(1/t));


        4楼2015-06-09 11:30
        回复
          clear
          d1=@(x,A)cos(x).*(A.*sin(x).^2+cos(x).^2);
          d2=@(x,A)-cos(x).*(A.*sin(x).^2+cos(x).^2);
          d3=@(x,y,A)sin(x)*sin(y)*(A*(sin(x)^2*cos(y)^2+cos(y)^2)+sin(x)^2*sin(y)^2);
          d4=@(x,y,A)-sin(x)*sin(y)*(A*(sin(x)^2*cos(y)^2+cos(y)^2)+sin(x)^2*sin(y)^2);
          d5=@(x,y,A)-sin(x)*cos(y)*(A*(sin(x)^2*sin(y)^2+cos(y)^2)+sin(x)^2*cos(y)^2);
          d6=@(x,y,A)sin(x)*cos(y)*(A*(sin(x)^2*sin(y)^2+cos(y)^2)+sin(x)^2*cos(y)^2);
          a=0;
          b=0;
          c=0;
          d=0;
          e=0;
          g=0;
          for A=[0,6,106]
          for k=1:10000
          x=pi*rand(1);
          y=2*pi*rand(1);
          a=a+d1(x,A);
          b=b+d2(x,A);
          c=c+d3(x,y,A);
          d=d+d4(x,y,A);
          e=e+d5(x,y,A);
          end
          a=pi*a/10000;
          b=pi*b/10000;
          c=2*pi*c/10000;
          d=2*pi*d/10000;
          e=2*pi*e/10000;
          g=max([a,b,c,e,d]);
          disp(A);
          disp(g);
          end
          disp('(>o<)');
          for A=[0,6,106]
          a=quad(@(x)cos(x).*(A.*sin(x).^2+cos(x).^2),0,pi);
          b=quad(@(x)-cos(x).*(A.*sin(x).^2+cos(x).^2),0,pi);
          c=dblquad(@(x,y)sin(x).*sin(y).*(A.*(sin(x).^2.*cos(y).^2+cos(y).^2)+sin(x).^2.*sin(y).^2),0,pi,0,2*pi);
          d=dblquad(@(x,y)-sin(x).*sin(y).*(A.*(sin(x).^2.*cos(y).^2+cos(y).^2)+sin(x).^2.*sin(y).^2),0,pi,0,2*pi);
          e=dblquad(@(x,y)sin(x).*cos(y).*(A.*(sin(x).^2.*sin(y).^2+cos(y).^2)+sin(x).^2.*cos(y).^2),0,pi,0,2*pi);
          g=max([a,b,c,e,d]);
          disp(g);
          end


          5楼2015-06-09 11:30
          回复
            clear
            d1=@(x,A)cos(x).*(A.*sin(x).^2+cos(x).^2);
            d2=@(x,A)-cos(x).*(A.*sin(x).^2+cos(x).^2);
            d3=@(x,y,A)sin(x)*sin(y)*(A*(sin(x)^2*cos(y)^2+cos(y)^2)+sin(x)^2*sin(y)^2);
            d4=@(x,y,A)-sin(x)*sin(y)*(A*(sin(x)^2*cos(y)^2+cos(y)^2)+sin(x)^2*sin(y)^2);
            d5=@(x,y,A)-sin(x)*cos(y)*(A*(sin(x)^2*sin(y)^2+cos(y)^2)+sin(x)^2*cos(y)^2);
            d6=@(x,y,A)sin(x)*cos(y)*(A*(sin(x)^2*sin(y)^2+cos(y)^2)+sin(x)^2*cos(y)^2);
            a=0;
            b=0;
            c=0;
            d=0;
            e=0;
            g=0;
            f=0;
            h=0;
            for A=[0,6,106]
            for k=1:10000
            x=pi*rand(1);
            y=2*pi*rand(1);
            a=d1(x,A);
            b=d2(x,A);
            c=d3(x,y,A);
            d=d4(x,y,A);
            e=d5(x,y,A);
            f=d6(x,y,A);
            g=g+max([a,b,c,d,e]);
            end
            g=g/10000;
            disp(g);
            end
            disp('(>o<)');
            for A=[0,6,106]
            a=quad(@(x)cos(x).*(A.*sin(x).^2+cos(x).^2),0,pi);
            b=quad(@(x)-cos(x).*(A.*sin(x).^2+cos(x).^2),0,pi);
            c=dblquad(@(x,y)sin(x).*sin(y).*(A.*(sin(x).^2.*cos(y).^2+cos(y).^2)+sin(x).^2.*sin(y).^2),0,pi,0,2*pi);
            d=dblquad(@(x,y)-sin(x).*sin(y).*(A.*(sin(x).^2.*cos(y).^2+cos(y).^2)+sin(x).^2.*sin(y).^2),0,pi,0,2*pi);
            e=dblquad(@(x,y)sin(x).*cos(y).*(A.*(sin(x).^2.*sin(y).^2+cos(y).^2)+sin(x).^2.*cos(y).^2),0,pi,0,2*pi);
            g=max([a,b,c,e,d]);
            disp(g);
            end


            6楼2015-06-09 11:30
            回复