Problem with Matlab code
1 view (last 30 days)
Show older comments
avinash desh
on 12 Nov 2015
Commented: Walter Roberson
on 13 Nov 2015
Hello, I am trying to run his code(attached) in matlab but solver does not run to give an answer or error. need help if anyone would know what is wrong with this code. I am trying to find xc1,yc1 with given input values(x1,y1,x2,y2,R)Any help would be very much appreciated.
Thanks
0 Comments
Accepted Answer
Star Strider
on 12 Nov 2015
The solver doesn’t run because you had it (and the line before it) as comments!
When I ran this I got [1.7, 0.07] for the results:
x1=1.35;
x2=2;
y1=0.07;
y2=0.07;
R=1.5;
initialvals = rand(1,2);
XCYC = fminsearch( @(xyc) (x1-xyc(1))^2+(y1-xyc(2))^2 - R^2 + (x2-xyc(1))^2+(y2-xyc(2))^2 - R^2, initialvals);
6 Comments
More Answers (0)
See Also
Categories
Find more on Entering Commands 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!