1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| answ1 = input ('Which variable do you want to bas the calculation on either Frequency or Theta ? (F/T)', 's'); %ask user to input value of Frequency or Theta.
strcmp1 = strcmp (answ1,'Frequency'); %
strcmp2 = strcmp (answ1,'Theta'); % define the values strcmp 1,2,3,4 to
strcmp3 = strcmp (answ1,'f'); %
strcmp4 = strcmp (answ1,'t'); % the comparaison of answ1 to Y || N
strcmp5 = strcmp (answ1,'inf'); %
while isempty(str2double(answ1)) || str2double(answ1) < 0 || isreal(str2double(answ1)) || strcmp1 == 0 || strcmp2 == 0 || strcmp3 == 0 || strcmp4 == 0 || strcmp5 == 1; %check if the value of answ1 is equal to either a Y or a N
fprintf (' \n'); %empty ligne
disp ('You have not answered the question proprely please reanswer by F/T') %infrom user of his mistake
answ2 = input ('Which variable do you want to bas the calculation on either Frequency or Theta ? (F/T)', 's'); %ask user to input value of Frequency or Theta.
strcmp1 = strcmp (answ2,'Frequency'); %
strcmp2 = strcmp (answ2,'Theta'); % define the values strcmp 1,2,3,4 to
strcmp3 = strcmp (answ2,'f'); %
strcmp4 = strcmp (answ2,'t'); % the comparaison of answ1 to Y || N
strcmp5 = strcmp (answ2,'inf');
if strcmp1 == 1 || strcmp3 == 1; %if user wants to input his value of Q
fprintf (' \n'); %empty ligne
F =input('Please enter value for Frequency ', 's');%ask user to innput the value of the frequency
while isnan(str2double(F)) || ~isreal(str2double(F)) || isinf(str2double(F)) || isempty(F) ; % test if the value of c is valid
fprintf (' \n'); %empty ligne
disp ('The value entered for the Frequency is invalid.');
F=input('Please reenter value for Frequency '); %ask user to reenter the value for c
end
disp ('The value of the Frequency is know set to be: ');
disp (F); %indicate the value of the Frequency to the user
elseif strcmp1 == 1 || strcmp4 == 3; %if user wants to input his value of Theta
fprintf (' \n'); %empty ligne
theta =input('Please enter value for Theta ', 's');%ask user to innput the value of theta
while isnan(str2double(theta)) || ~isreal(str2double(theta)) || isinf(str2double(theta)) || isempty(theta) ; % test if the value of c is valid
fprintf (' \n'); %empty ligne
disp ('The value entered for the Theta is invalid.');
theta =input('Please reenter value for Theta '); %ask user to reenter the value for theta
end
disp ('The value of the Theta is know set to be: ');
disp (theta); %indicate the value of the Frequency to the user
theta1 = theta/57.2957795; %converting theta in degrees
end
end
if strcmp1 == 1 || strcmp2 == 1; %if user wants to input his value of Frequency
fprintf (' \n'); %empty ligne
F =input('Please enter value for Frequency ', 's');%ask user to innput the value of the frequency
while isnan(str2double(F)) || ~isreal(str2double(F)) || isinf(str2double(F)) || isempty(F) ; % test if the value of c is valid
fprintf (' \n'); %empty ligne
disp ('The value entered for the Frequency is invalid.');
F=input('Please reenter value for Frequency '); %ask user to reenter the value for c
end
disp ('The value of the Frequency is know set to be: ');
disp (F); %indicate the value of the Frequency to the user
elseif strcmp3 == 1 || strcmp4 == 1; %if user wants to input his value of Theta
fprintf (' \n'); %empty ligne
theta =input('Please enter value for Theta ', 's');%ask user to innput the value of theta
while isnan(str2double(theta)) || ~isreal(str2double(theta)) || isinf(str2double(theta)) || isempty(theta) ; % test if the value of c is valid
fprintf (' \n'); %empty ligne
disp ('The value entered for the Theta is invalid.');
theta =input('Please reenter value for Theta '); %ask user to reenter the value for theta
end
disp ('The value of the Theta is know set to be: ');
disp (theta); %indicate the value of the Frequency to the user
theta1 = theta/57.2957795; %converting theta in degrees
end |
Partager