当前位置:网站首页>毫无章法系列
毫无章法系列
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)
边栏推荐
- goto Statement
- Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
- ICML 2022 | Meta propose une méthode robuste d'optimisation bayésienne Multi - objectifs pour faire face efficacement au bruit d'entrée
- How MySQL uses JSON_ Extract() takes JSON value
- MYSQL group by 有哪些注意事项
- Kafaka technology lesson 1
- 机器学习02:模型评估
- 一口气读懂 IT发展史
- Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
- C#(Winform) 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
猜你喜欢
Oracle recovery tools -- Oracle database recovery tool
thinkphp3.2.3
机器学习02:模型评估
Complete solution instance of Oracle shrink table space
stirring! 2022 open atom global open source summit registration is hot!
Which is more cost-effective, haqu K1 or haqu H1? Who is more worth starting with?
C # mixed graphics and text, written to the database in binary mode
ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise
十个顶级自动化和编排工具
深入理解Redis内存淘汰策略
随机推荐
Vulnerability recurrence - 48. Command injection in airflow DAG (cve-2020-11978)
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!
What are the precautions for MySQL group by
33: Chapter 3: develop pass service: 16: use redis to cache user information; (to reduce the pressure on the database)
如何修改mysql字段为自增长字段
WebApp开发-Google官方教程
統計php程序運行時間及設置PHP最長運行時間
33:第三章:开发通行证服务:16:使用Redis缓存用户信息;(以减轻数据库的压力)
世界上最难的5种编程语言
Mongodb (quick start) (I)
如何保存训练好的神经网络模型(pytorch版本)
winedt常用快捷键 修改快捷键latex编译按钮
读libco保存恢复现场汇编代码
统计php程序运行时间及设置PHP最长运行时间
Rider 设置选中单词侧边高亮,去除警告建议高亮
C # realizes crystal report binding data and printing 3-qr code barcode
一文了解Go语言中的函数与方法的用法
In depth understanding of redis memory obsolescence strategy
MySQL之知识点(七)
Ordinary programmers look at the code, and top programmers look at the trend