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

 采纳的回答

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 个评论

Hello, Would it be possible to attach your code, I am still unable to run to get the answers after removing the comments
I did attach the relevant part of it, which was the solver fminsearch call.
Also, the semicolons (;) at the end of each line suppress Command Window output. Add this line at the end of your code:
Result = [xc1, yc1]
and you will see:
Result =
1.6750 1.5344
for [xc1 yc1].
Thank you, it works. I did not realize I had semicolon's.
My pleasure.
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
This has been answered in the Question you created for this topic.

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by