I want to draw trapezoidal fuzzy function in Matlab with codes below but error occurred using plot 3 and vector must be the same length

1 view (last 30 days)
X1=linspace(0.143324275,0.148726949); X2=linspace(0.14826949,0.159464495); X3=linspace(0.159464495,0.164799513); X4=linspace(0.13788047,0.148726949); X5=linspace(0.159464495,0.170112121); Y1=(0.8*(x1-0.143324275))*(0.148726949-0.143324275).^-1; Y2=0.8; Y3=(0.8*(0.164799513-x3))*(0.164799513-0.159464495).^-1; Y4=(x4-0.13788047)*(0.148726949-0.13788047).^-1; Y5=1; Y6=(0.170112121-x5)*(0.170112121-0.159464495).^-1; Z1=1*(x1+1).^-1; Z2=1*(x2+1).^-1; Z3=1*(x3+1).^-1; Z4=1*(x4+1).^-1; Z5=1*(x5+1).^-1; Plot(x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x2,y5,z2,x5,y6,z5)

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 23 Mar 2019
Edited: KALYAN ACHARJYA on 23 Mar 2019
Please Note: You have defined X1, not x1 ..same for all...Matlab is case sensitive. Therefore X1 is different from x1
X1=linspace(0.143324275,0.148726949);
X2=linspace(0.14826949,0.159464495);
X3=linspace(0.159464495,0.164799513);
X4=linspace(0.13788047,0.148726949);
X5=linspace(0.159464495,0.170112121);
Y1=(0.8*(X1-0.143324275))*(0.148726949-0.143324275).^-1;
Y2=0.8;
Y3=(0.8*(0.164799513-X3))*(0.164799513-0.159464495).^-1;
Y4=(X4-0.13788047)*(0.148726949-0.13788047).^-1;
Y5=1;
Y6=(0.170112121-X5)*(0.170112121-0.159464495).^-1;
Z1=1*(X1+1).^-1;
Z2=1*(X2+1).^-1;
Z3=1*(X3+1).^-1;
Z4=1*(X4+1).^-1;
Z5=1*(X5+1).^-1;
plot(X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,X4,Y4,Z4,X2,Y5,Z2,X5,Y6,Z5)

Categories

Find more on Data Clustering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!