当前位置:网站首页>Disorganized series
Disorganized series
2022-07-05 17:42:00 【Selvaggia】
Hands-on practice
solve、dsolve
clc,clear;
syms m V rho g k;
% Solving differential equations ( The solution is to satisfy the differential equation The relationship between variables )
dsolve('Dy==5') %dy/dt=5
dsolve('Dy==x','x') %dy/dx=x If no variable is specified, it defaults to t
dsolve('D2y==1+Dy','y(0)==1','Dy(0)==0')%d2y/dt2=1+dy/dt, Initial conditions 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
% Symbolic variables are defined in advance , You can write an expression directly in function brackets , No quotes ;
% If there is no definition, put it in quotation marks
%solve Solution of general equations
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; % Solve a system of binary first-order equations , Solution is a structure
eq2=3*x+5*y-4;
s3=solve(eq1,eq2,x,y);% Only s3 Bearing result s3 For vector group , You can use [x,y] Undertaking
s3=[s3.x,s3.y]
s1=solve(sin(x)==1/2)
s2=solve(x^3-1==0)
%ode For solving numerical solutions of differential equations , See for example CSDN, The point is
% Standard form of differential equation , You can always find multiple variables Such as F(y,y',y'',y''',…,t)=0
%y,y',y'',y''' It's a variable , To set a vector , Do variable substitution
% Like a vector x: x(1)=y,x(2)=y'
%ode45 The main part of the function List each variable separately Yes t Derivative d x(2) The expression of
vpa,simplify,subs
syms x y z
f=cos(x)^2-sin(x)^2
s1 = simplify(f)
s1 = cos(2*x)
% Do not match the file name with matlab The inherent function name is the same !!!
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')
% The differential equation has only one variable s, Or say The solution of the differential equation is s And t The relation of
s=subs(s,{
m,V,rho,g,k},{
239.46,0.2058,1035.71,9.8,0.6})
% R = subs(S, old, new) utilize new Instead of the symbol ! expression ! in old Value
s=vpa(s,10)
% The exact solution obtained when using symbolic calculation will show scores , It can be used vpa Convert to decimal display
%vpa The action object can be numeric or ! expression !( Numerical precision in expressions )( Significant figures )
%s=dsolve('m*DV==m*g-rho*g*V-K*V')
syms f(x)
a=1/99
x=sym(1/2)
y=vpa(x)
边栏推荐
- Count the running time of PHP program and set the maximum running time of PHP
- Design of electronic clock based on 51 single chip microcomputer
- 如何修改mysql字段为自增长字段
- stirring! 2022 open atom global open source summit registration is hot!
- 漫画:有趣的海盗问题 (完整版)
- Is it safe and reliable to open futures accounts on koufu.com? How to distinguish whether the platform is safe?
- Oracle缩表空间的完整解决实例
- mongodb(快速上手)(一)
- Cartoon: a bloody case caused by a math problem
- 云安全日报220705:红帽PHP解释器发现执行任意代码漏洞,需要尽快升级
猜你喜欢

Which is more cost-effective, haqu K1 or haqu H1? Who is more worth starting with?
Complete solution instance of Oracle shrink table space
What are the precautions for MySQL group by

flask接口响应中的中文乱码(unicode)处理

Machine learning 01: Introduction
Oracle缩表空间的完整解决实例

mongodb(快速上手)(一)

leetcode每日一题:字符串中的第一个唯一字符

哈趣K1和哈趣H1哪个性价比更高?谁更值得入手?

Machine learning 02: model evaluation
随机推荐
Force deduction solution summary 729- my schedule I
Redis+caffeine two-level cache enables smooth access speed
查看自己电脑连接过的WiFi密码
Database design in multi tenant mode
C#(Winform) 当前线程不在单线程单元中,因此无法实例化 ActiveX 控件
mysql中取出json字段的小技巧
SQL Server(2)
MYSQL group by 有哪些注意事项
How to save the trained neural network model (pytorch version)
提高應用程序性能的7個DevOps實踐
QT console printout
Oracle recovery tools -- Oracle database recovery tool
为什么阳历中平年二月是28天
漫画:如何实现大整数相乘?(下)
ICML 2022 | Meta propose une méthode robuste d'optimisation bayésienne Multi - objectifs pour faire face efficacement au bruit d'entrée
基于Redis实现延时队列的优化方案小结
Cartoon: looking for the k-th element of an unordered array (Revised)
About JSON parsing function JSON in MySQL_ EXTRACT
Compter le temps d'exécution du programme PHP et définir le temps d'exécution maximum de PHP
stirring! 2022 open atom global open source summit registration is hot!