Given this information, would the following be correct:
0 for x < term minimum
(x-term minimum)/5 for term minimum <= x < term top
1-(x-term top)/5 for term top <= x < term maximum
0 for x > term maximum
And would the following program work (I tested it and it seems to be okay.
It's based upon the figures just mentioned.)?:
/* Program to determine the degree of membership of a temperature in
JUST_RIGHT
Language: C/C++
Created: 4/23/1998
By: David Falksen
*/
#include <stdio.h>
void main(void){
//Define Terms
double JUST_RIGHT_MINIMUM = 60;
double JUST_RIGHT_MAXIMUM = 70;
double JUST_RIGHT_TOP = 65;
//Define Misc.
double TEMPERATURE = 66;
double just_right_membership_value = 0;
//If TEMPERATURE below term range, set membership to Zero
if (TEMPERATURE < JUST_RIGHT_MINIMUM){
just_right_membership_value = 0;
}
//If TEMPERATURE between minimum and top, compute membership
else if ( (JUST_RIGHT_MINIMUM <= TEMPERATURE) && (TEMPERATURE <
JUST_RIGHT_TOP) ){
printf ("%f\n",just_right_membership_value);
just_right_membership_value = (TEMPERATURE - JUST_RIGHT_MINIMUM)/5;
printf ("%f\n",just_right_membership_value);
}
//If TEMPERATURE between top and maximum, compute membership
else if ( (JUST_RIGHT_TOP <= TEMPERATURE) && (TEMPERATURE <
JUST_RIGHT_MAXIMUM) ){
just_right_membership_value = 1-(TEMPERATURE - JUST_RIGHT_TOP)/5;
printf ("%f\n",just_right_membership_value);
}
//If TEMPERATURE beyond term range, set membership to Zero
else if (TEMPERATURE > JUST_RIGHT_MAXIMUM){
just_right_membership_value = 0;
}//End If..Else
}//End Main
I appreciate your help so far!