当前位置:网站首页>毫无章法系列
毫无章法系列
2022-07-05 17:16:00 【Selvaggia】
solve、dsolve
clc,clear;
syms m V rho g k;
%微分方程求解(解就是满足微分方程的 变量之间的关系式)
dsolve('Dy==5') %dy/dt=5
dsolve('Dy==x','x') %dy/dx=x 没指定变量则默认为t
dsolve('D2y==1+Dy','y(0)==1','Dy(0)==0')%d2y/dt2=1+dy/dt,初始条件y(0)=1,dy(0)/dt=0
[y1,y2]=dsolve('Dx==y+x','Dy==2*x','x(0)==0','y(0)==1')%dx/dt=y+x,dy/dt=2*x,x(0)=0,y(0)=1,x=y5,y=y6
%提前定义了符号变量,就可以直接在函数括号里写表达式,不用加引号;
%没定义那么就放在引号里
%solve对一般方程的求解
syms x y a;
eq=x^2+2*x+1;
s1=solve(eq,x)
eq=a*x+2;
s2=solve(eq,a)
eq1=x+2*y-8; %解二元一次方程组,解是个结构体
eq2=3*x+5*y-4;
s3=solve(eq1,eq2,x,y);%只用s3承载结果则s3为向量组,可用[x,y]承接
s3=[s3.x,s3.y]
s1=solve(sin(x)==1/2)
s2=solve(x^3-1==0)
%ode用于求微分方程的数值解,实例见CSDN,重点在于
%微分方程的标准形式,总能找出多个变量 如F(y,y',y'',y''',…,t)=0
%y,y',y'',y'''就是变量,要设一个向量,做变量替换
%如向量x: x(1)=y,x(2)=y'
%ode45 函数主要部分 要分别列出每个变量 对t求导的 d x(2) 的表达式
vpa,simplify,subs
syms x y z
f=cos(x)^2-sin(x)^2
s1 = simplify(f)
s1 = cos(2*x)
% 文件名不要与matlab固有函数名重名!!!
clc,clear;
syms m V rho g k;
s=dsolve('m*D2s=m*g-rho*g*V-k*Ds','s(0)=0','Ds(0)=0')
%该微分方程只有一个变量s,或者说 微分方程的解就是s与t的关系式
s=subs(s,{
m,V,rho,g,k},{
239.46,0.2058,1035.71,9.8,0.6})
% R = subs(S, old, new) 利用new的值代替符号!表达式!中old的值
s=vpa(s,10)
%使用符号计算时得到的精确解会出现分数,可以用vpa转换为小数显示
%vpa作用对象可以是数值或者!表达式!(表达式中的数值精度)(有效数字)
%s=dsolve('m*DV==m*g-rho*g*V-K*V')
syms f(x)
a=1/99
x=sym(1/2)
y=vpa(x)
边栏推荐
- MySql 查询符合条件的最新数据行
- URP下Alpha从Gamma空间到Linner空间转换(二)——多Alpha贴图叠加
- ICML 2022 | Meta提出魯棒的多目標貝葉斯優化方法,有效應對輸入噪聲
- 统计php程序运行时间及设置PHP最长运行时间
- Example tutorial of SQL deduplication
- Debug kernel code through proc interface
- Kafaka技术第一课
- Cartoon: how to multiply large integers? (next)
- 力扣解法汇总1200-最小绝对差
- 使用QT设计师界面类创建2个界面,通过按键从界面1切换到界面2
猜你喜欢

查看自己电脑连接过的WiFi密码
MYSQL group by 有哪些注意事项

北京内推 | 微软亚洲研究院机器学习组招聘NLP/语音合成等方向全职研究员

ICML 2022 | Meta提出魯棒的多目標貝葉斯優化方法,有效應對輸入噪聲

Which is more cost-effective, haqu K1 or haqu H1? Who is more worth starting with?

Rider 设置选中单词侧边高亮,去除警告建议高亮
Redis+caffeine two-level cache enables smooth access speed

winedt常用快捷键 修改快捷键latex编译按钮

How to write a full score project document | acquisition technology

Kafaka technology lesson 1
随机推荐
[7.7 live broadcast preview] the lecturer of "typical architecture of SaaS cloud native applications" teaches you to easily build cloud native SaaS applications. Once the problem is solved, Huawei's s
十个顶级自动化和编排工具
This 17-year-old hacker genius cracked the first generation iPhone!
Mongodb (quick start) (I)
Alpha conversion from gamma space to linner space under URP (II) -- multi alpha map superposition
[binary tree] insufficient nodes on the root to leaf path
域名解析,反向域名解析nbtstat
winedt常用快捷键 修改快捷键latex编译按钮
Winedt common shortcut key modify shortcut key latex compile button
Domain name resolution, reverse domain name resolution nbtstat
一文了解MySQL事务隔离级别
提高应用程序性能的7个DevOps实践
读libco保存恢复现场汇编代码
Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
SQL Server(2)
mysql中取出json字段的小技巧
About JSON parsing function JSON in MySQL_ EXTRACT
MySQL之知识点(六)
查看自己电脑连接过的WiFi密码
一文了解Go语言中的函数与方法的用法