您好,欢迎来到年旅网。
搜索
您的当前位置:首页Matlab9-如何用matlab对隐函数求导.docx

Matlab9-如何用matlab对隐函数求导.docx

来源:年旅网
如何用matlab对隐函数求

隐函数求导一般都比较繁琐,下面介绍一下如何用matlab对 隐函数求导,这样一来我们就可以双手,轻松求解隐函数 的导数。

1.matlab求导指令diff简介:

这个函数是单词differential (微分)的简写,用于计算 微分,实际上计算的是差商,可以计算一阶导数的有限差分 近似。

d肝指令的具体用法(调用语法)如下:

d肝(函数),求的一阶导数;

cHff(函数,n),求的n阶导数(n是具体整数); diff(函数,变量名),求对的偏导数;

下面是doc diff的帮助信息:

Search

Contents p ▼ fx « Data Analysis ► Derivatives and Integrals ► diff

理There are other functions or methods named diff: ' fin3nce/diff, ident/diff. symbolic/diff Search Results 二 0 MATLAB

©• ► Getting Started j 由 V? User's

Guide

白 A Functions

S Desktop Tools and Deve 王

Data Import and Export t!

Mathematics

0 Data Analysis IS Basic

Operations

• ♦ • •

• • • •• • •

• • 2 •

dlff

Differences and approximate derivatives

Syntax

Y = diff(X) Y = di ff (X.n) I = difftt,^ dim)

Description

Y = diff (X) calculates diff ere nces betwee n adjace nt eleme nts of X.

If X is a vector, then di ff (X) returns a vector, one element shorter than X, of differences between adjacent elements:

[X(2)-X (1) X(3)-X(2)・・・ X(n)-X (n-1)]

If X is a matrix, then diff (X) returns a matrix of row differences:

[X(2:m. :)-X (l:m-l,:)]

In generalz diff (X) returns the differences calculated along the first non-singleton (size (X, dim) > 1) dimension of X・

® Descriptive Statistics

由 Filtering and Convolui O

Interpolation and Rec : : \\

① Fourier Transforms

:

S Derivatives and Integi [-A

cumtrapz -\"

H fx del2 ・ D.drff • nr

: F fa

2•对隐函数求导,下面就用matlab求一下隐函数cos(x+siny)=siny的 导 数。具体的代码及计算结果如下图所示:

: Command Window

3•用新的变量名dydx替代dgdx中的diff(y(x), x),具体的代码及计算

结果如下图所示:

图55

4•对变量dgdxl代表的符号方程关于dydx的求解,使得dy/dx通过x, y表达出来。具体的代码及计算结果如下图所示:

i、Command Windov/

File Edit Debug Desktop Window Help

>> dydx二solve(dgdxlJ dydx')

x + sin(y(x))))

rr

r

顾.

图56

注意:1•生成隐函数的指令中y必须写成y(x),表明y是x的函数。

2•笫三步中把dgdx变量所包含的diff(y(x), x)字符串替换为 dydx,这是必须的步骤,因为cHff(y(x)z x)不能作为求解的变量名使用。

MATLAB之家 更多MATLAB教程、经验、电子书、视频教程等,请访问《之家: www.matlabhome.cn》

MATLAB

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- oldu.cn 版权所有 浙ICP备2024123271号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务