Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Designing Membership Functions | Membership Functions and Fuzzy Sets
Fuzzy Logic and Approximate Reasoning

bookChallenge: Designing Membership Functions

Task

Swipe to start coding

You are working with fuzzy sets, where elements belong to a set with a certain degree of membership rather than a strict yes-or-no decision.

Your goal is to design a triangular membership function and use it to compute membership values for given inputs.

Instructions

  1. Define a function triangular_membership(x, a, b, c):
    • a is the left boundary;
    • b is the peak where membership equals 1;
    • c is the right boundary.
  2. The function must return:
    • 0 if x is less than or equal to a or greater than or equal to c;
    • a linearly increasing value between a and b;
    • a linearly decreasing value between b and c.
  3. Use this function to compute membership values for the inputs 2, 5, and 8 using parameters a = 0, b = 5, and c = 10.
  4. Store the results in the variables:
    • membership_low;
    • membership_medium;
    • membership_high.

Solution

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

close

bookChallenge: Designing Membership Functions

Swipe to show menu

Task

Swipe to start coding

You are working with fuzzy sets, where elements belong to a set with a certain degree of membership rather than a strict yes-or-no decision.

Your goal is to design a triangular membership function and use it to compute membership values for given inputs.

Instructions

  1. Define a function triangular_membership(x, a, b, c):
    • a is the left boundary;
    • b is the peak where membership equals 1;
    • c is the right boundary.
  2. The function must return:
    • 0 if x is less than or equal to a or greater than or equal to c;
    • a linearly increasing value between a and b;
    • a linearly decreasing value between b and c.
  3. Use this function to compute membership values for the inputs 2, 5, and 8 using parameters a = 0, b = 5, and c = 10.
  4. Store the results in the variables:
    • membership_low;
    • membership_medium;
    • membership_high.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 2. ChapterΒ 4
single

single

some-alt