I have this in my code
N=ones(1,numel(ma)); % ma is a matrix can be given from other equations.
N(ma==45 | ma==135)=0.5;N(0< ma<45 | 45<ma<90)=1.5;N(0< ma<45 | 45<ma<90)=1.5;N(90<ma<135 | 135<ma<180)=1.5;N(ma==0 | ma==180)=0;N(ma==90)=1;NA=N';NN=sum(NA(:));Pn=ones(1,numel(NN));Pn(NN>5)= 100000;Pn(NN==5)=100000;Pn(NN<5)=1;
I had the pervious fcn, but is doesn’t work.
The results as
ma=[-35.2644,0,0,-45.0000,-45.0000,0,35.2644,54.7356,30.0000,45.0000,0,-45.0000,30.0000,-54.7356,-54.7356,-54.7356,-35.2644]N=[1.5000,0,0,1.5000,1.5000,0,1.5000,1.5000,1.5000,1.5000,0,1.5000,1.5000,1.5000,1.5000,1.5000,1.5000]
In other words I want to say:-
If ma=45 or 135 (with negative or positive signs) make N =0.5If ma=0 or 180 , make N =0If ma=90 or 275 (with negative or positive signs) make N =1Otherwise make N= 1.5
Then Pn like that
If NN>or =5 make Pn=100000If NN<5 Make Pn=1
Best Answer