Problem with Matlab code

1 view (last 30 days)
avinash desh
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

Accepted Answer

Star Strider
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
avinash desh
avinash desh on 12 Nov 2015
Hello Sir, I have run into another issue with a different code.I have attached my code for which I ma getting "Subscript indices must either be real positive integers or logicals" error. I am trying to plot u,v from data file, which has 10000 pieces of data (basically in x,y,z). xi,yi are the centers and trying to plot contours on pad between concentric circles(between ri and r0). Any help with this error I would very much appreciate it.
Thanks
Walter Roberson
Walter Roberson on 13 Nov 2015
This has been answered in the Question you created for this topic.

Sign in to comment.

More Answers (0)

Categories

Find more on Entering Commands in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!