I am writing code and plotting a guassian chart and when i do it a guassian chart comes up but i do not know if it is correct and i am getting the error that the value assigned to variable 'g3' might be unused, here is my code below
function guasmem1
x= 2; % given x value
v= 0; % centre, e.g. 0
s= 2; % width >0
% calculate degree of membership (g3) for a given x
g1=(x-v)/s;
g2=abs(g1);
g3=exp(-(1/2)*(g2.^2));
%plotting membership func for centre (V) and width (S)
% can define v1 in anyway, needs different min and max
% values
v1=(v-6):((1+abs(v))/100):(v+6);
g1=(v1-v)/s;
g2=abs(g1);
g3= exp(-(1/2)*(g2.^2));
plot(v1,g3)
end
Best Answer