Matlab - envolvente

 
Vista:

envolvente

Publicado por javier (10 intervenciones) el 22/02/2007 16:21:01
hola a todos:

como hago para graficarle una envolvente a una funcion.

gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:envolvente

Publicado por fismat (5 intervenciones) el 23/02/2007 00:02:20
Hola javier

podrias seguir el ejemplo de la función "sphere" que diguja una esfera en matlab.

function [xx,yy,zz] = sphere(n)
%SPHERE Generate sphere.
% [X,Y,Z] = SPHERE(N) generates three (N+1)-by-(N+1)
% matrices so that SURF(X,Y,Z) produces a unit sphere.
%
% [X,Y,Z] = SPHERE uses N = 20.
%
% SPHERE(N) and just SPHERE graph the sphere as a SURFACE
% and do not return anything.
%
% See also ELLIPSOID, CYLINDER.

% Clay M. Thompson 4-24-91, CBM 8-21-92.
% Copyright 1984-2002 The MathWorks, Inc.
% $Revision: 5.8 $ $Date: 2002/06/05 20:05:17 $

if nargin == 0, n = 20; end

% -pi <= theta <= pi is a row vector.
% -pi/2 <= phi <= pi/2 is a column vector.
theta = (-n:2:n)/n*pi;
phi = (-n:2:n)'/n*pi/2;
cosphi = cos(phi); cosphi(1) = 0; cosphi(n+1) = 0;
sintheta = sin(theta); sintheta(1) = 0; sintheta(n+1) = 0;

x = cosphi*cos(theta);
y = cosphi*sintheta;
z = sin(phi)*ones(1,n+1);

if nargout == 0
surf(x,y,z)
else
xx = x; yy = y; zz = z;
end
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:envolvente

Publicado por Almustafa (1 intervención) el 21/03/2007 04:49:17
Prueba esto:

hDatos = hilbert(Datos);
envolvente = sqrt(Datos.*Datos+hDatos.*conj(hDatos));

%Graficar resultados

hold on;
plot(Datos);
p1 = plot(envolvente);
set(p1, 'Color', 'red');
hold off;

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar