当前位置:网站首页>毫无章法系列
毫无章法系列
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)
边栏推荐
- Zhang Ping'an: accelerate cloud digital innovation and jointly build an industrial smart ecosystem
- VBA驱动SAP GUI实现办公自动化(二):判断元素是否存在
- Beijing internal promotion | the machine learning group of Microsoft Research Asia recruits full-time researchers in nlp/ speech synthesis and other directions
- 漫画:如何实现大整数相乘?(整合版)
- 力扣解法汇总729-我的日程安排表 I
- 基于Redis实现延时队列的优化方案小结
- Flow characteristics of kitchen knife, ant sword, ice scorpion and Godzilla
- URP下Alpha从Gamma空间到Linner空间转换(二)——多Alpha贴图叠加
- C (WinForm) the current thread is not in a single threaded unit, so ActiveX controls cannot be instantiated
- Ordinary programmers look at the code, and top programmers look at the trend
猜你喜欢

MySQL之知识点(七)

CMake教程Step1(基本起点)

Rider 设置选中单词侧边高亮,去除警告建议高亮
Database design in multi tenant mode
In depth understanding of redis memory obsolescence strategy

C # mixed graphics and text, written to the database in binary mode

Seven Devops practices to improve application performance

ICML 2022 | meta proposes a robust multi-objective Bayesian optimization method to effectively deal with input noise

机器学习02:模型评估

Which is more cost-effective, haqu K1 or haqu H1? Who is more worth starting with?
随机推荐
stirring! 2022 open atom global open source summit registration is hot!
得知女儿被猥亵,35岁男子将对方打至轻伤二级,法院作出不起诉决定
解决“双击pdf文件,弹出”请安装evernote程序
Winedt common shortcut key modify shortcut key latex compile button
33:第三章:开发通行证服务:16:使用Redis缓存用户信息;(以减轻数据库的压力)
[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
MySQL之知识点(六)
How MySQL uses JSON_ Extract() takes JSON value
Cartoon: how to multiply large integers? (integrated version)
菜刀,蚁剑,冰蝎,哥斯拉的流量特征
服务器配置 jupyter环境
漫画:有趣的海盗问题 (完整版)
证券网上开户安全吗?证券融资利率一般是多少?
CVPR 2022最佳学生论文:单张图像估计物体在3D空间中的位姿估计
Flow characteristics of kitchen knife, ant sword, ice scorpion and Godzilla
Summary of optimization scheme for implementing delay queue based on redis
MySql 查询符合条件的最新数据行
C#(Winform) 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
Flask solves the problem of CORS err
企业数字化发展中的六个安全陋习,每一个都很危险!