My vectors appear to be the same length but I am still getting error for plot
Show older comments
Hi there, I am trying to do an iterative and random sampling best fit plot. I keep getting error, saying that "vectors must be the same length. My mat1 is 38 x 2, RP1 is 38 x 1 and Dmge is 38 x 1. Any suggestions
mat1 = [Dmge RP1];
for ii=1:10
b = randsample(1:38,35);
A= 5500; B=0.19; C=2.3;
goemp_fit1 = @(y)sum((y(1)*exp(-exp(-y(2)*(x(1,:)-y(3))))-x(2,:)).^2);
coeff = fminsearch(goemp_fit1,[A B C]);
A = coeff(1);
B = coeff(2);
C = coeff(3);
y2 = A*exp(-exp(-B*(RP1-C)));
y2_tp = transpose(y2);
plot(mat1(b,2),y2,'-','Color',mcolour(ii,:))
xlabel('Flow3');
ylabel('Damage ($000USD)');
title('Damage v Flow3');
end
3 Comments
madhan ravi
on 14 Sep 2018
Can you provide the mat1 details?
Naveed Hossain
on 15 Sep 2018
Accepted Answer
More Answers (0)
Categories
Find more on Phased Array System Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!