当前位置:网站首页>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)
边栏推荐
- 一文了解MySQL事务隔离级别
- Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
- Force deduction solution summary 729- my schedule I
- 一文了解Go语言中的函数与方法的用法
- 深入理解Redis内存淘汰策略
- 力扣解法汇总729-我的日程安排表 I
- 数据访问 - EntityFramework集成
- Machine learning 01: Introduction
- MySql 查询符合条件的最新数据行
- 33:第三章:开发通行证服务:16:使用Redis缓存用户信息;(以减轻数据库的压力)
猜你喜欢
To solve the problem of "double click PDF file, pop up", please install Evernote program
ICML 2022 | Meta propose une méthode robuste d'optimisation bayésienne Multi - objectifs pour faire face efficacement au bruit d'entrée
MATLAB查阅
c#图文混合,以二进制方式写入数据库
Abnormal recovery of virtual machine Oracle -- Xi Fenfei
MySQL之知识点(七)
Design of electronic clock based on 51 single chip microcomputer
MySQL之知识点(六)
thinkphp3.2.3
What are the precautions for MySQL group by
随机推荐
SQL删除重复数据的实例教程
Cloud security daily 220705: the red hat PHP interpreter has found a vulnerability of executing arbitrary code, which needs to be upgraded as soon as possible
Abnormal recovery of virtual machine Oracle -- Xi Fenfei
VBA drives SAP GUI to realize office automation (II): judge whether elements exist
证券网上开户安全吗?证券融资利率一般是多少?
QT console printout
Cartoon: interesting pirate problem (full version)
Read the history of it development in one breath
Humi analysis: the integrated application of industrial Internet identity analysis and enterprise information system
Disabling and enabling inspections pycharm
leetcode每日一练:旋转数组
Cartoon: a bloody case caused by a math problem
Understand the usage of functions and methods in go language
Troubleshooting - about clip not found Visual Studio
Cartoon: looking for the k-th element of an unordered array (Revised)
2022 information system management engineer examination outline
The five most difficult programming languages in the world
Count the running time of PHP program and set the maximum running time of PHP
Machine learning 01: Introduction
Ant financial's sudden wealth has not yet begun, but the myth of zoom continues!