Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Non - Singleton Errors

Subject: Non - Singleton Errors

From: Pathiraja

Date: 2 Jan, 2012 23:41:07

Message: 1 of 1

I'm trying the below CODE

for i = 1:3
        
    for j = 1:2
        omega(j) = 2*pi*j;
        
        a = 0.2;
        finish = 0;
        add = 1;
        while finish == 0
            
            for k = 1:size(r1,2)

                % Local Quantities Calculation
                Loc(k) = r1(k);
                VT(j,k) = omega(j)*Loc(k);
                W2(i,j,k) = sqrt((i*(1+1))^2 + omega(j)^2*Loc(k)^2);
                Phi(i,j,k) = atan((i*(1+a))/VT(j,k));
                Alpha(i,j,k) = RTheta + T1*Loc(k) - rad2deg(Phi(i,j,k));
                
                % Local Coefficient Calculations
                CL(i,j,k) = aa*deg2rad(Alpha(i,j,k));
                CD(i,j,k) = Cdo + K*CL(i,j,k)^2;
                
                % Local Force Calculations
                Lift(i,j,k) = 0.5*ro*W2(i,j,k)^2*Cr*aa*deg2rad(Alpha(i,j,k));
                Drag(i,j,k) = 0.5*ro*W2(i,j,k)^2*Cr*CD(i,j,k);
                Dt(i,j,k) = (Lift(i,j,k)*cos(Phi(i,j,k)))-(Drag(i,j,k)*sin(Phi(i,j,k)));
                Dq(i,j,k) = (Lift(i,j,k)*sin(Phi(i,j,k)))+(Drag(i,j,k)*cos(Phi(i,j,k)));
                Dpr(i,j,k) = Dq(i,j,k)*VT(j,k);
                
                % Local Efficiency Calculation
                eff(i,j,k) = Dt(i,j,k)*(i*(1 + a))/Dpr(i,j,k);
            end

            % Efficiency calculation
            Thrust = sum(Dt,3)*rStep;
            da = Thrust/(2*ro*Ar*i^2);
            anew = (a + da)/2;
            
            if (a - anew)<1e-10
                finish = 1;
            end
            
            a = anew;
            add = add + 1;
            
            if add > 500
                finish = 1;
            end
        end
        Torque = sum(Dq,3)*rStep;
        Pr = sum(Dpr,3)*rStep;
        Eff = Thrust.*repmat((MinV:size(Thrust,1))',1,size(Thrust,2))./Pr;
        AdvRatio(i,j) = i/(j*D);
    end
end

But when I execute the code I get below error message,

??? Assignment has more non-singleton rhs dimensions than non-singleton
subscripts

Error in ==> BEMMT at 63
                Phi(i,j,k) = atan((i*(1+a))/VT(j,k));

Could someone help me to get correct this error

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us