Sorry for the long title but I'm not too sure how I'd go about defining this in a small sentence.
I want a set of values to be chosen if the input falls within a range of values e.g. input = 135 so should fall between 90 < input <= 180.
Here's the code I'm using:
Alpha = input('Specify angle of rotation (0 - 360): ');if Alpha > 360 Alpha = input('Specify angle of rotation (0 - 360: ');elseif Alpha <= 0 Alpha = input('Specify angle of rotation (0 - 360: ');elseif isempty(Alpha) Alpha = input('Specify angle of rotation (0 - 360: ');endAlpha = Alpha*(pi/180)a = sqrt(((cos(Alpha)^2))*((cos(Theta)^-2)-1))b = sqrt((a^2)*((((cos(Alpha))^-2)-1)))if 0 <= Alpha <= (90*(pi/180)) ZA = (2*(((cos(Theta))^-2)-1))^0.5; ZB = a; ZC = 0 ; ZD = b;endif (90*(pi/180)) < Alpha <= (180*(pi/180)) ZA = b; ZB = (2*(((cos(Theta))^-2)-1))^0.5; ZC = a; ZD = 0;endif (180*(pi/180)) < Alpha <= (270*(pi/180)) ZA = 0; ZB = b; ZC = (2*(((cos(Theta))^-2)-1))^0.5; ZD = a;endif (270*(pi/180)) < Alpha < (360*(pi/180)) ZA = a; ZB = 0; ZC = b; ZD = (2*(((cos(Theta))^-2)-1))^0.5;end
At the moment it is assuming the conditions of the last if statement.
Basically how do I write 90 < Alpha <= 180 so that MATLAB will be able to process it?
I think I can get away with coding this using 'elseif' to reduce the size but I'd rather sort the problem out first.
I would be very grateful for help as this is for the final part of my dissertation which is due next week.
Thanks
Best Answer