Optimisation of X Y calculation code?
Show older comments
Please help. The following is code from my application and is used to calculate the X value for a given Y value. I am having a problem because I need to repeat this process four times and before it is complete Matlab locks up and displays a message saying 'Windows system has run out of resources'. For this reason can anyone help optimise this process?
To explain: I have 456 data files containing 600 data readings (Y value) and their row numbers (X value). The difference of the Y values are passed through this process 4 times to calculate the X value for those points representing the maximum and minimum difference of the first 200 Y values, and then the maximum and minimum difference of the remaining Y values. This then loops until all of the data files have completed this process. My code below creates a plot each time as part of this calculation, and I assume that this is the reason why I run out of system resources, but I'm not sure how to improve the code? Any ideas?
% Calculates the equivalent X value for the Y value given.
x = dfxy(:,1,:);
y = dfxy(:,2,:);
yMinaxis = min(y);
yMaxaxis = max(y);
ylim([yMinaxis yMaxaxis]);
indexAtMax = find(y == dfymax1);
xAtMax = x(indexAtMax); % Sets xAtMax as the X value
close all;
xpointsymax1(i,:) = xAtMax; % Create array to hold all x points
All help is greatly appreciated.
Accepted Answer
More Answers (0)
Categories
Find more on Surrogate Optimization in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!