🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #10781

Re: 'Problema' con las funciones en Octave

#10781
From: Han Solo
Date: Tue, 05 Feb 2002 23:55
101 lines
3863 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ridiculum@bionichat.com (Ra�l (Ridiculum)) writes:

>    Bueno, me voy a tirar a la piscina, ya no he hecho todo lo posible por
> no aprender matlab durante mi periplo por la universidad y estoy a punto de
> consguirlo.

Lo primero, gracias por responder.

>    Si prop1 y prop2 son escalares debes usar el . antes de cualquier
> operacion tal y como dice Santiago. 
>    Otra cosa es que si quieres que las llamadas a contrib_e sean mas o
> menos asi:
>    contrib_e(0.1, 10);
>    contrib_e(0.2, 10);
>    .
>    .
>    .
>    contrib_e(10,10);

Bueno, en rigor prop2 tambi�n es variable. Esto ir� dando una familia
de curvas. Lo de fijar prop2=10 era por simplificar, de forma que s�lo
tuviera una variable. De todas formas, vale de momento.

>    Pues en ese caso, y debera tener el mismo tama�o que x, pero con todos
> los valores a 10, algo asi:
>    y = (10 * ones ( length(x) ) ); 
>    Eso de arriba usa la funcion ones que existe en matlba, en octave no se.

S� existe, aunque la sintaxis correcta ser�a:

y = (10 * ones ( 1,length(x) ) );

Si no se define com matriz fila, crea una matriz cuadrada de x*x

De todas formas, no ha funcionado como deber�a, pero casi. He
modificado la funci�n para usar el operador '.' com suger�a Santiago
(la pego al final). La cosa ha mejorado algo, pero sigue sin ir:

octave:44> x=(1:5);
octave:45> y = (10 * ones ( 1,length(x) ) )
y =

  10  10  10  10  10

octave:46> [v1,v2]=contrib_e(x,y)
v1 = 0.25000

v2 =

  0.100000  0.050000  0.033333  0.025000  0.020000

v2 si que va cogiendo lo valores que debe, pero �por qu� v1 es s�lo un
escalar? De todas formas, van por aqu� los tiros.

Y por rematar. �c�mo ser�a con dos variables? Con este sistema me
parece que no nos vamos a escapar del bucle for...endfor, ya que
cuando tengamos dos variables, seguro que las dimensiones de x e y van
a ser distintas.

- ---------------
function [p1,p2]=contrib_e(prop1, prop2)

b=1;
l=prop1.*b;
h=b .* prop2;

e1=b;
e2=2.*h;
e3=l;

edef=min([e1 e2 e3]);


p1=0.25 .* edef./b;
p2=0.1 .* edef./l;

endfunction
- -----------------
- -- 
Un Saludo

Han Solo
The Rebel Alliance

Emacs is not on every system

So what? [...] Do you tell your administrative people to stick with
notepad.exe? Do you tell your fat kids they can only have the crummy
games that come with their video games or plain dress that comes with
Barbie?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard <http://www.gnupg.org/>

iEYEARECAAYFAjxgcOAACgkQ4FjpJaPEp23IkQCgvFcHi0t9fzbhboaGc9VJ0bq5
s4UAoNZ3304mFRVQGEsk0g0Z+HXwHqzJ
=6qVi
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <87n0ynwkkc.fsf@alderaan.maptel.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!18-mad2-x30.libre.retevision.ES!not-for-mail
References: <a3luna$mkv$1@localhost.localhost> <slrna5vlc8.ci.Ridiculum@localname.localdomain>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,283a8ae4bef81f1a,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2002-02-05 18:57:10 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!18-mad2-x30.libre.retevision.ES!not-for-mail
From: Han Solo <hsolo@escomposlinux.org>
Newsgroups: es.comp.os.linux.programacion
Subject: Re: 'Problema' con las funciones en Octave
Date: 06 Feb 2002 00:55:15 +0100
Organization: The Rebel Alliance
Lines: 101
Message-ID: <87n0ynwkkc.fsf@alderaan.maptel.es>
References: <a3luna$mkv$1@localhost.localhost> <slrna5vlc8.ci.Ridiculum@localname.localdomain>
NNTP-Posting-Host: 18-mad2-x30.libre.retevision.es (62.83.132.18)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1012964228 44401633 62.83.132.18 (16 [63837])
X-Orig-Path: alderaan.maptel.es!not-for-mail
User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7