Clear Filters
Clear Filters

Help defining normalized SSE for problem based objective function

1 view (last 30 days)
Hi all, I'm using problem-based solving to fit some coefficients in a differential equation to some experimental data that I'm reading in from an Excel file. Everything is working well. But I have some issues in that I'm working with multiple data sets simulaneously that span a wide range of responses and the sets at the high end of the distribution are forcing the fit at the expense of the datasets at the low end of the distribution just due to the fact that I'm using a sum-square-error objective function:
obj = sum(sum((myfcn - experimentalData{5:height(experimentalData),3:width(experimentalData)}).^2));
There are individual data sets in each column of the experimentalData table with different ranges. I want to scale the objective function calculation by the mean of these datasets.
I have calculated the mean for each one:
cAverage(i) = mean(experimentalData{5:height(experimentalData),i+2}); % there are two dummy columns before the data
What I want is a simple expression to divide the delta between the result of the calculated function and the experimental data by the average. So a matrix divided by a vector, by column.
When I type manually in the script prompt the right equation for this:
(myfcn - experimentalData{5:height(experimentalData),3:width(experimentalData)})./cAverage,
it appears to work, but when I edit the formula to
add this in and run the script, I'm getting an error for the argument dimensions must agree.
Can someone give me a clue how to do a normalized SSE objective function?
Thanks,
Tony

Answers (1)

Matt J
Matt J on 3 Feb 2022
Edited: Matt J on 3 Feb 2022
add this in and run the script, I'm getting an error for the argument dimensions must agree.
Well, we have no idea what you've done to ensure that myfcn is the same size as your experimentalData block, but assuming you have, then,
selection = experimentalData{5:height(experimentalData),3:width(experimentalData)};
Error= ( myfcn-selection./mean(selection,1) );
SSE=sum( Error.^2,'all');
  10 Comments
Anthony Ozzello
Anthony Ozzello on 3 Feb 2022
Hi Matt,
I got it working with the NMSE definition above for the objective function on a single line and everything is working well now. I appreciate the time you spend trying to help me figure this out.
Tony

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!