2 views (last 30 days)
Show older comments
JEEVITHA on 18 Nov 2023
Commented: Sam Chak on 19 Nov 2023
Open in MATLAB Online
find the points of intersection between 𝑥^2+𝑦^2=3 and 𝑥𝑦=1. Convert this into a system of two nonlinear algebraic equations.solve a system of two nonlinear algebraic equations using multivariable Newton-Raphson method with an initial guess of 𝑥=1, 𝑦=1.
dx = 0.1;
x = 0:0.1:5;
f2=xy-1
f1=x.^2+y.^2-3;
y2 = 1×51
1.7321 1.7349 1.7436 1.7578 1.7776 1.8028 1.8330 1.8682 1.9079 1.9519 2.0000 2.0518 2.1071 2.1656 2.2271 2.2913 2.3580 2.4269 2.4980 2.5710 2.6458 2.7221 2.8000 2.8792 2.9597 3.0414 3.1241 3.2078 3.2924 3.3779
figure(1)
p = plot(x, y1, x, y2);
p(1).LineStyle = "-.";
p(2).LineWidth = 2;
r = find(y1 == y2);
x_intersection = x(r);
x_value_intersection = y1(r);
figure(2)
p2=plot(x, y1, x, y2, x_intersection, x_value_intersection, 'o');
3 Comments Show 1 older commentHide 1 older comment
Show 1 older commentHide 1 older comment
Steven Lord on 18 Nov 2023
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2048902-how-to-find-intersect-with-2-lines#comment_2966322
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Sam Chak on 18 Nov 2023
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2048902-how-to-find-intersect-with-2-lines#comment_2966402
Hi @JEEVITHA,
I understand that Newton–Raphson doesn't require plotting as long as it can find the intersection using the numerical method. However, as advised previously, you should plot the circle and the reciprocal function. Follow the steps provided, even though the homework question does not explicitly require you to plot them.
This will aid in your learning if you genuinely want to understand the material, not just for the sake of submitting the homework and passing the course.
Sam Chak on 19 Nov 2023
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2048902-how-to-find-intersect-with-2-lines#comment_2966832
Hi @JEEVITHA
I see the reciprocal function in y1, but I don't see the circle in y2.
Can you please show the original question again?
Sign in to comment.
Sign in to answer this question.
Answers (1)
Sam Chak on 18 Nov 2023
Hi @JEEVITHA
If you post like this, your question will likely be closed by the mods later. Please plot the circle and the reciprocal function on the same graph using the plot() function.
Do you know what the Newton–Raphson algorithm is? Without seeing the procedure, I cannot provide guidance. Of course, I can search on Google, but it's better if you search since this is your homework.
1 Comment Show -1 older commentsHide -1 older comments
Show -1 older commentsHide -1 older comments
Sam Chak on 19 Nov 2023
Direct link to this comment
https://www.mathworks.com/matlabcentral/answers/2048902-how-to-find-intersect-with-2-lines#comment_2966917
Open in MATLAB Online
Hi @JEEVITHA
The curves are incorrectly plotted because f1 and f2 in your code are unused. The circle requires some algebraic manipulations to plot upper and lower arcs.
As a hint, if you are proficient in pure math algebraic manipulations, you will arrive at the answers with the values related to the Golden Ratio. As you can see, the intersections are around x = ±0.6 and x = ±1.6.
% circle: x² + y² = 3
x1 = linspace(-sqrt(3), sqrt(3), 347);
y1a = sqrt(3 - x1.^2); % upper arc
y1b = - sqrt(3 - x1.^2); % lower arc
plot(x1, y1a, x1, y1b, 'color', '#0920b8'), hold on
% reciprocal function: y = 1/x
x2a = linspace(0.35, 3, 266);
x2b = linspace(-3, -0.35, 266);
y2 = @(x) 1./x;
plot(x2a, y2(x2a), x2b, y2(x2b), 'color', '#b80909')
% labels
legend('Circle', '', 'Reciprocal fcn', '')
xlabel('x'), ylabel('y')
grid on
axis equal
Sign in to comment.
Sign in to answer this question.
See Also
Categories
Mathematics and OptimizationSymbolic Math ToolboxMathematicsCalculus
Find more on Calculus in Help Center and File Exchange
Tags
- point of intersion and linear differntial equation
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office