Você está na página 1de 2

## -*- texinfo -*## @deftypefn {Function File} {} laplace (@var{funcion}) ## @deftypefnx {Function File} {} laplace (@var{funcion}, @var{t}) ## @deftypefnx

{Function File} {} laplace (@var{funcion}, @var{t}, @var{s}) ## ## Utiliza GNU-Maxima para calcular la transformada de Laplace del string @var{f uncion}. ## La salida es un string con la funcion transformada. ## GNU-Maxima puede encontrarse en http://maxima.sourceforge.net/ ## ## @var{t} es la variable de la funcion @var{funcion}, si se omite se asumira @s amp{"t"}. ## @var{s} es la variable de la transformada, si se omite se asumira @samp{"s"}. ## ## Ejemplos: ## ## @example ## @group ## laplace ("sin(2*t)") ## @result{} 2/(s^2+4) ## @end group ## @group ## laplace ("sin(2*x)","x") ## @result{} 2/(s^2+4) ## @end group ## @group ## laplace ("sin(2*x)","x","r") ## @result{} 2/(r^2+4) ## @end group ## @end example ## ## ## @seealso{ilaplace, maxima} ## @end deftypefn ## ## ## Ejemplo: ## ## @example ## @group ## s = tf ("s"); ## @end group ## @group ## g = eval(laplace ("sin(2*t)")) ## ## @result{} Transfer function 'g' from input 'u1' to output ... ## ## @result{} 2 ## @result{} y1: ------## @result{} s^2 + 4 ## ## @result{} Continuous-time model. ## @end group ## @end example ## Author: Alejandro Regodesebes ## v.1.0 - Copyright (C) 2012 Alejandro Regodesebes # # This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by

# # # # # # # # # #

the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see .

function resultado = laplace(comando,t="t",s="s") if (not(ischar(t))) error("El segundo argumento debe ser un string con la variable de la fun cin a transformar."); endif if (not(ischar(s))) error("El tercer argumento debe ser un string con la variable de la func in transformada."); endif if (nargin == 0 || nargin > 3) print_usage (); error("Cantidad de argumentos incorrecta."); endif if (ischar(comando)) comando = strtrim(comando); [nn,salida] = system(['maxima -q --batch-string="display2d:false;laplace (',comando,',',t,',',s,');"']); resultado = strtrim(substr(salida,rindex(salida,"(%o")+5)); resultado(resultado == "%") = ""; else printf("ERROR: el argumento debe ser un string\n"); print_usage (); endif endfunction

Você também pode gostar