Ai
1 Star 0 Fork 0

Vincent/MATLAB_Study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
lesson11.m 879 Bytes
一键复制 编辑 原始数据 按行查看 历史
VINCENT 提交于 2022-10-25 17:43 +08:00 . MATLAB学习(修改版2)
%%
%1.求y=0的结果
syms x
y = x*sin(x)-x;
solve(y, x)
cos(x)
%cos(x)的平方
syms x
solve('(cos(x))^2-(sin(x))^2', x)
%%
%2.二元一次方程式
syms x y
eq1 = x - 2*y - 5;
eq2 = x + y - 6;
A = solve(eq1,eq2,x,y)
%%
%3.未知ab求方程结果
syms x a b
solve('a*x^2-b')
%求b的关系
syms x a b
solve('a*x^2-b', 'b')
%%
%4.syms求积分
syms x
y = 4*x^5;
yprime = diff(y)
%%
%5.符号集成
syms x; y = x^2*exp(x);
z = int(y); z = z-subs(z, x, 0)
%%
%6.fsolve()数值根求解器
f2 = @(x) (1.2*x+0.3+x*sin(x));
fsolve(f2,0)
%%
%7fzero()数值根求解器
f=@(x)x.^2
fzero(f,0.1)%必须与x轴相交
fsolve(f,0)
%%
%8迭代次数容错
f=@(x)x.^2
options=optimset('MaxIter',1e3,'TolFun',1e-10);
fsolve(f,0.1,options)
fzero(f,0.1,options)
%%
%9递归
function output = fact(n)
% fact recursively finds n!
if n==1
output = 1;
else
output = n * fact(n-1);
end
end
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
其他
1
https://gitee.com/Vincentstudy/MATLAB_Study.git
git@gitee.com:Vincentstudy/MATLAB_Study.git
Vincentstudy
MATLAB_Study
MATLAB_Study
master

搜索帮助