Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.1.0 - Português


diffxy

derivative of y with respect to x

Syntax

dydx = diffxy(x, y)
dydx = diffxy(x, y [, N, dim])

Arguments

x

scalar, vector or matrix of doubles

y

vector or matrix of doubles

N

integer, the order of differentiation. Default value: 1.

dim

integer or string, Available values: 1, 2, "r" and "c". Default value: find(size(y) > 1, 1)

Description

dydx=diffxy(x, y) compute the derivative of y with respect to x. dydx will be the same size as y. diffxy also handles unequally spaced data and treats the edges using the higher accuracy.

dydx = diff(x, y, N, dim) is the Nth difference function along dimension dim.

Default value for N is 1. Default value for dim is find(size(y) > 1, 1).

dim='r' is equivalent to dim=1 and dim='c' is equivalent to dim=2.

Examples

Equally spaced data

clf();
x = linspace(0, %pi, 1e3);
y = cos(x);
dy = diffxy(x, y);
plot(x, -sin(x), "ro", x, dy, "k*");
legend(["-sin(x)", "diffxy(x, y)"]);

Unequally spaced data

clf();
x = linspace(0, %pi, 1e3) + rand(1, 1e3, "normal") * 0.1;
y = cos(x);
dy = diffxy(x, y);
plot(x, -sin(x), "ro", x, dy, "k*");
legend(["-sin(x)", "diffxy(x, y)"])

See also

  • diff — diferença e derivada discreta

History

VersãoDescrição
2025.1.0 Introduction in Scilab.
Report an issue
<< diff Equações Diferenciais impl >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu May 22 12:56:16 CEST 2025