Filter löschen
Filter löschen

how to make graph with nine inputs and one output

9 Ansichten (letzte 30 Tage)
Mamta
Mamta vor etwa 5 Stunden
Beantwortet: Umar vor etwa 3 Stunden
I have make a fis of nine input and one output now i execute surfview('file.fis') in this graph display at a time by taking two input and one output . but my problem is i have nine input and one output . i want to display at a time in a single graph containing all nine inputs and one output for better comparison and readbility. please help its realted to my research work thanks

Antworten (1)

Umar
Umar vor etwa 3 Stunden

Hi @Mamta,

Let me address your query regarding, “I have make a fis of nine input and one output now i execute surfview('file.fis') in this graph display at a time by taking two input and one output . but my problem is i have nine input and one output . i want to display at a time in a single graph containing all nine inputs and one output for better comparison and readbility. please help its realted to my research work thanks”

The surfview function in MATLAB is indeed limited to displaying only two inputs at a time along with the output. However, there is an alternative approach you can take to visualize your FIS more effectively by using parallel coordinates. This method will allow you to plot all inputs on parallel axes, making it easier to compare their effects on the output. Here is the updated code,

% Create a new fuzzy inference system using mamfis
fis = mamfis('Name', 'example_fis');

For more information on mamfis function, please refer to

https://www.mathworks.com/help/fuzzy/mamfis.html

% Define nine input variables
for i = 1:9
  fis = addInput(fis, [0 10], 'Name', ['Input ' num2str(i)]);
  fis = addMF(fis, ['Input ' num2str(i)], 'trimf', [0 0 5], 'Name', 'Low');
  fis = addMF(fis, ['Input ' num2str(i)], 'trimf', [5 10 10], 'Name', 'High');
end
% Define one output variable
fis = addOutput(fis, [0 100], 'Name', 'Output');
fis = addMF(fis, 'Output', 'trimf', [0 0 50], 'Name', 'Low');
fis = addMF(fis, 'Output', 'trimf', [50 100 100], 'Name', 'High');
% Sample data generation
num_samples = 100;
input_data = rand(num_samples, 9) * 10; % Random input data
output_data = rand(num_samples, 1) * 100; % Random output data
% Create a figure for parallel coordinates
figure;
hold on;
% Normalize the input data
input_data_norm = (input_data - min(input_data)) ./ (max(input_data) -     
min(input_data));
% Plot parallel coordinates
for i = 1:num_samples
  plot(input_data_norm(i,:), output_data(i), '-o', 'MarkerFaceColor', 'b');
end
xlabel('Normalized Inputs');
ylabel('Output');
title('Output Visualization Based on All Inputs');
grid on;
hold off;

So, as you can see the code initializes a new Mamdani fuzzy inference system (fis) and adds nine input variables, each with a triangular membership function (MF) for Low and High classifications and defines one output variable with similar membership functions which makes sure that you can effectively evaluate how changes in each input influence the output. Then, it generates random sample data for both inputs and outputs, where you might have varying input conditions leading to different outputs. Afterwards, the visualization is achieved through parallel coordinates plotting, which is particularly useful for comparing multiple dimensions (in this case, inputs) against a single dimension (the output). The line input_data_norm = (input_data - min(input_data)) ./ (max(input_data) - min(input_data)); normalizes the input data by making sure that all input variables are on the same scale, facilitating better visualization. A loop iterates through each sample, plotting normalized inputs against the corresponding output value which allows you to see how each combination of input values corresponds to the output.

Please see attached.

If you have any further questions, please let me know.

Community Treasure Hunt

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

Start Hunting!

Translated by