求直线和曲线交点,离散或连续曲线。

请问求直线y=x和一条曲线y=(-1.477e-5)x^3+0.05013x^2-0.001057*x-4.987在x大于10以后的交点怎么求呢,谢谢?
我写了一下程序,但是报错,有没有什么更好的程序,可以使x的范围连续
clear;
clc;
syms x y
x=10:0.1:60
f1=x-y;
f2=(-1.477e-5)*x^3+0.05013*x^2-0.001057*x-4.987-y;
   [x,y]=solve(f1,f2);
   x=double(x)
   y=double(y)
   plot(x,y)

 Accepted Answer

kahine
kahine on 30 Mar 2023

0 votes

这个问题很简单啊,既然你都知道用solve函数,你看看这个函数的帮助文件,举的例子就是sin(x) == x^2 - 1;而且还带绘图,带求解具体的值,你换成你的函数不就得了,多看看帮助才能成长
syms x
eqn = x == (-1.477e-5)*x^3+0.05013*x^2-0.001057*x-4.987;
S = solve(eqn,x);
V = vpasolve(eqn,x); %有三个解分别为
% -4.127550240554986891034769540832
% 24.245503424174890648425950143157
% 3373.9240237967458874167982732993
fplot([lhs(eqn) rhs(eqn)], [0 3500])
hold on
plot(V(V>10),V(V>10),'ro')

2 Comments

Roderick
Roderick on 13 Feb 2024
感谢您提供的解决方案和建议!我会仔细阅读solve函数的帮助文件并尝试将您给出的例子应用到我的函数上。再次感谢您的帮助!
DGM
DGM on 13 Feb 2024
Your comment might not be spam, but this thread is. This was one of hundreds, if not thousands of threads that were crossposted by spambots using content scraped from this forum:
Those countless spam threads have thoroughly trained the spam filter to hit on anything written in chinese.
I'm still tempted to delete this thread, but if you're using it, I'll leave it alone.

Sign in to comment.

More Answers (0)

Tags

Asked:

on 30 Mar 2023

Commented:

DGM
on 13 Feb 2024

Community Treasure Hunt

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

Start Hunting!