当前位置:网站首页>毫无章法系列
毫无章法系列
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)
边栏推荐
- Troubleshooting - about clip not found Visual Studio
- Design of electronic clock based on 51 single chip microcomputer
- 一文了解Go语言中的函数与方法的用法
- IDEA 项目启动报错 Shorten the command line via JAR manifest or via a classpath file and rerun.
- Cartoon: looking for the k-th element of an unordered array (Revised)
- Cartoon: how to multiply large integers? (next)
- Abnormal recovery of virtual machine Oracle -- Xi Fenfei
- 漫画:有趣的海盗问题 (完整版)
- Webapp development - Google official tutorial
- Mysql5.6 parsing JSON strings (supporting complex nested formats)
猜你喜欢

基于51单片机的电子时钟设计

Design of electronic clock based on 51 single chip microcomputer
What are the precautions for MySQL group by

Use of ThinkPHP template

CMake教程Step4(安装和测试)

统计php程序运行时间及设置PHP最长运行时间
Complete solution instance of Oracle shrink table space

提高应用程序性能的7个DevOps实践

漏洞复现----48、Airflow dag中的命令注入(CVE-2020-11978)

Mongodb (quick start) (I)
随机推荐
Oracle缩表空间的完整解决实例
证券网上开户安全吗?证券融资利率一般是多少?
漫画:一道数学题引发的血案
7 pratiques devops pour améliorer la performance des applications
Troubleshooting - about clip not found Visual Studio
IDEA 项目启动报错 Shorten the command line via JAR manifest or via a classpath file and rerun.
ICML 2022 | Meta提出鲁棒的多目标贝叶斯优化方法,有效应对输入噪声
ClickHouse(03)ClickHouse怎么安装和部署
C # realizes crystal report binding data and printing 3-qr code barcode
33:第三章:开发通行证服务:16:使用Redis缓存用户信息;(以减轻数据库的压力)
外盘黄金哪个平台正规安全,怎么辨别?
Complete solution instance of Oracle shrink table space
Redis+caffeine two-level cache enables smooth access speed
排错-关于clion not found visual studio 的问题
菜刀,蚁剑,冰蝎,哥斯拉的流量特征
Winedt common shortcut key modify shortcut key latex compile button
WebApp开发-Google官方教程
普通程序员看代码,顶级程序员看趋势
Cartoon: how to multiply large integers? (I) revised version
MySQL之知识点(六)