Upcoming SlideShare
×

# 6

300 views

Published on

DESIGN AND SIMULATE REAL TIME PROBLEM

Published in: Education
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
300
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
10
0
Likes
0
Embeds 0
No embeds

No notes for slide

### 6

1. 1. EX.NO:6 DESIGN AND SIMULATE REAL TIME PROBLEM USINGDATE: FUZZY BASED SYSTEMAIM: To design and simulate real time problem using fuzzy based system.PROBLEM DESCRIPTION: Gas Mileage Prediction illustrates the prediction of fuel consumption forautomobiles, using data from previously recorded observations.Automobile MPG (milesper gallon) prediction is a typical nonlinear regression problem, in which severalattributes of an automobiles profile information are used to predict another continuousattribute.PROCEDURE: 1. The six input attributes are no. of cylinders, displacement,horsepower, weight, acceleration, and model year. 2. The output variable to be predicted is the fuel consumption in MPG. 3. The data set is obtained from the original data file auto-gas.dat. 4. The function |exhsrch| performs an exhaustive search within the available inputs to select the set of inputs that most influence the fuel consumption. 5. ANFIS returns the error with respect to training data and checking data 6. The input-output surface shown above is a nonlinear and monotonic surface and illustrates how the ANFIS model will respond to varying values ofweight and year.PROGRAM: [data, input_name] = loadgas; trn_data = data(1:2:end, :); chk_data = data(2:2:end, :); exhsrch(1, trn_data, chk_data, input_name); input_index = exhsrch(2, trn_data, chk_data, input_name); exhsrch(3, trn_data, chk_data, input_name); close all; new_trn_data = trn_data(:, [input_index, size(trn_data,2)]); new_chk_data = chk_data(:, [input_index, size(chk_data,2)]); in_fismat = genfis1(new_trn_data, 2, gbellmf); [trn_out_fismat trn_error step_size chk_out_fismat chk_error] = ... anfis(new_trn_data, in_fismat, [100 nan 0.01 0.5 1.5], [0,0,0,0], new_chk_data, 1); [a, b] = min(chk_error);
2. 2. plot(1:100, trn_error, g-, 1:100, chk_error, r-, b, a, ko);title(Training (green) and checking (red) error curve);xlabel(Epoch numbers);ylabel(RMS errors);N = size(trn_data,1);A = [trn_data(:,1:6) ones(N,1)];B = trn_data(:,7);coef = AB;Nc = size(chk_data,1);A_ck = [chk_data(:,1:6) ones(Nc,1)];B_ck = chk_data(:,7);lr_rmse = norm(A_ck*coef-B_ck)/sqrt(Nc);% Printing resultsfprintf(nRMSE against checking datanANFIS : %1.3ftLinear Regression :%1.3fn, a, lr_rmse);chk_out_fismat = setfis(chk_out_fismat, input, 1, name, Weight);chk_out_fismat = setfis(chk_out_fismat, input, 2, name, Year);chk_out_fismat = setfis(chk_out_fismat, output, 1, name, MPG);gensurf(chk_out_fismat);plot(new_trn_data(:,1), new_trn_data(:, 2), bo, ... new_chk_data(:,1), new_chk_data(:, 2), rx);xlabel(Weight);ylabel(Year);title(Training (o) and checking (x) data);displayEndOfDemoMessage(mfilename)
3. 3. OUTPUT:
4. 4. PREPARATION 30 PERFORMANCE 30 RECORD 40 TOTAL 100RESULT: Thus the program is implemented and output is verified successfully.