Tuesday 15 July 2014

matlab - Error in curve fitting and other syntax issues -


I have a set of vector 'measured_data' that contains 200 sample data that are positive floating point values. I have a hard time finding a model that fits this data. The following code returns an error in each step, i.e. the prediction of the comment (), throws another error in the next command ... so nothing is working. I went through the well documented and understood me I do not know what the problem is and where I am going. I would be really grateful if a person could pass through code and help reduce problems. Thanks.

  Undefined function for the input argument of 'double' type 'prediction' without error in the title (line 157) model 2_pread = approximate (model 2_koff, model2_data, 1);   

Code

  model1 = ar (measured_data, 2, 'yw'); Model2 = ar (measured_data, 5, 'or'); Coeffs1 = model1.a; Model1_coeff = [coeffs1 (2) coeffs1 (3)] coeffs2 = model2.a; Model2_coeff = [coeffs2 (2) coeffs2 (3) coeffs2 (4) coeffs2 (5)] x (1) = 0.0; X (2) = 0.0; Y (1) = 0.0; Y (2) = 0.0; Y (3) = 0.0; Y (4) = 0.0; Fix for Model1 by inserting coefficient values ​​of% I = 3: 200x (i) = coeff1 (2) * x (i-1) + coeff2 (3) * x (i-2); End model 1_data = x; Fix for model2 by inserting coefficient values ​​of% i = 5: 200 y (i) = coeff2 (2) * y (i-1) + coeff2 (3) * y (i-2) + coeff2 (4) * . Y (i-3) + Koff 2 (5) * y (i-4); End model 2_data = y; Model1_pred = Estimated (model 1_copf, model1_data, 1); Model1_residual = model1_data-model1_pred; Model1_err = resid (model1_coeff, measured_data); % Forecast error model 2_ er = resident (model2_coeff, measured_data); Subplot (1,2,1); Plot (model1_err); Subplot (1,2,2); Plot (model2_err); Model1_mse = sqrt (meaning ((measured_data-model1_coeff) ^ 2).); % Mean class error model2_mse = sqrt (meaning ((measured_data-model2_coeff). ^ 2)); Comparison (measured_data, model1_coeff, 'g', model2_coeff, 'b');  

If you are inputting wrong type input it is possible to get this error. For example, the standard example in the documentation works fine for me, but if I try something unnecessarily then I can get the same error:

  predict (1,1, 1)   

Check this:

  1. The first input is an idmodel or idnlmodel object (idpoly, which you will get from AR, ok).
  2. The second input (data) is an isadet object (timaries).

No comments:

Post a Comment