Implementing GaussianMF - Error using plot - Conversion to double from sym is not possible

1 view (last 30 days)
I used double() to convert sym to double even then i'm getting error
Code -
% program to implement gaussian membership function
% Routine for Gaussian MF
x = 1:1:100;
prompt = 'Enter width of Gaussian MF:';
w = input(prompt);
prompt = 'Enter centre point Gaussian of MF:';
c = input(prompt);
gaussian = exp(-0.5*((x-c)/w).^2);
subplot(2,1,1), plot(x,gaussian)
xlabel('Variable'), ylabel('Degree of belongingness'), title('Gaussian MF')
% Routine for Headge Operator
% solved in reference to Pg.55, 56 Neuro - Fuzzy Soft Computing Jang-Sun-Miztuani
prompt = 'Enter choice for hedge operator 1-more, 2-less, 3-very, 4-extremely :';
operator = input(prompt);
switch operator
case 1
k = 2;
case 2
k = 0.5;
case 3
k = 3;
case 4
k = 4;
end
clear x;
syms x;
hedgefunc = int((gaussian.^k)/x, 'x');
y = 1:1:100;
hedgedfunc = subs(hedgefunc,y)
hedgedGaussian = double(hedgedfunc)
subplot(2,1,2), plot(x,hedgedGaussian)
xlabel('Variable'), ylabel('Degree of belongingness'), title('Hedged Gaussian MF')
I keep on getting this error
Error using plot
Conversion to double from sym is not possible.
Error in q1gaussianmf (line 34)
subplot(2,1,2), plot(x,hedgedGaussian)
Also I'm defining y=1:1:100 then why I'm getting 10000 values

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!