Google Answers Logo
View Question
 
Q: Voss's Agorithm in Matlab ( No Answer,   0 Comments )
Question  
Subject: Voss's Agorithm in Matlab
Category: Computers > Algorithms
Asked by: craze4you-ga
List Price: $50.00
Posted: 20 Nov 2005 17:01 PST
Expires: 21 Nov 2005 02:44 PST
Question ID: 595587
Implementation of a Voss's Random Algorith in Matlab is required.
Full source code is required.
Comments for steps are required and a graph has to be produced as a result.

Clarification of Question by craze4you-ga on 20 Nov 2005 17:06 PST
"Agorithm", "algorith" = algorithm, of course
sorry for spelling errors, should have checked it.

Clarification of Question by craze4you-ga on 20 Nov 2005 17:23 PST
ps
maybe the code below may be helpful, but i do not know the language it
is written it.

---------------------------------
FUNCTION Voss_RandomAdditions, N


; generate Voss fractional Browninan motion in two dimension.
; see"Fractals" by Jen Feder page 180

;  R. F. Voss, "Random Fractal Forgeries", in "Fundimental Algorithms for
Computer Graphics",
;  editor R. A. Earnshaw, NATO ASI Series F, Computer and System Sciences,
Vol 17, 1985.

; This uses the Successive Random Additions algorithm rather than the
Successive Random Displacement
; algorithm which Voss shows to be non-stationary.

;****** NOTE FUDGE NOTE FUDGE *******************

; The lines:
;   IF i EQ 7 THEN Var = Var*0.9
;   IF i EQ 8 THEN Var = Var*0.85
;   IF i EQ 9 THEN Var = Var*0.5
; have been added in two places to correct the high frequency rise present
in the Voss spectrum

;****** NOTE FUDGE NOTE FUDGE *******************

nX = 2^N                    ; size of 2-D region modelled
X = FLTARR(nX+1,nX+1)             ; this will hold the fractal surface
H = 1.0/3.0                    ; dimension of surface is 3-H
Var = 1.0                    ; variance of largest scale
STD = SQRT(Var)

L = 2^N                     ; L is the largest scale computer so far
LD2 = L/2                    ; L/2 is the scale currently being computed
nL = 1

IDxL   = [0]
IDxLD2 = [LD2]
IDxLPL = [L]
IDxLnX = [ 0 , L ]

FOR i = 0 , N-1 DO BEGIN

;*************************************************************
;**     Stage 1: calculate the values at square centres       **
;*************************************************************

;  i.e we know A and are calculating B in           A A
;                                    B
;                                   A A

   ; Do all the interior centre interpolation points

   FOR iLy = 0 , nL-1 DO $
      X[IDxLD2,LD2+iLy*L] = 0.25*( X[IDxL,iLy*L] + X[IDxLPL,iLy*L] +
X[IDxL,iLy*L+L] + X[IDxLPL,iLy*L+L] ) + STD*RANDOMN(SEED,nL)

   ; Update the previously calculated points

   FOR iLy = 0 , nL DO $
      X[IDxLnX,iLy*L] = X[IDxLnX,iLy*L] + STD*RANDOMN(SEED,nL+1)

   Var = Var * SQRT(0.5)^(2.0*H)          ; adjust variance
;    IF i EQ 7 THEN Var = Var*0.9
;    IF i EQ 8 THEN Var = Var*0.85
;    IF i EQ 9 THEN Var = Var*0.5
   STD = SQRT(Var)

;*****************************************************************
;**     Stage 2: calculate the values around square centres       **
;*****************************************************************

;  i.e we know A and B and are calculating C in        ACA
;                                   CBC
;                                   ACA

; The complexity comes from dealing with C's on the outer edge of the region

   ; Do all the boundary interpolation points

; Top and bottom

   X[IDxLD2,0]  = 0.5*( X[IDxL,0 ] + X[IDxLPL,0 ] ) + STD*RANDOMN(SEED,nL)
   X[IDxLD2,nX] = 0.5*( X[IDxL,nX] + X[IDxLPL,nX] ) + STD*RANDOMN(SEED,nL)

; Left and right

   X[0 ,IDxLD2]  = 0.5*( X[0 ,IDxL] + X[0 ,IDxLPL] ) + STD*RANDOMN(SEED,nL)
   X[nX,IDxLD2]  = 0.5*( X[nX,IDxL] + X[nX,IDxLPL] ) + STD*RANDOMN(SEED,nL)

; Do all the C's inside the region

   FOR iLy = 1 , nL-1 DO $
      X[IDxLD2,iLy*L] = 0.25*( X[IDxL,iLy*L] + X[IDxLPL,iLy*L] +
X[IDxLD2,iLy*L-LD2] + X[IDxLD2,iLy*L+LD2] ) + STD*RANDOMN(SEED,nL)

   IF i GT 0 THEN BEGIN
      IDxL = IDxL[1:nL-1]
      FOR iLy = 0 , nL-1 DO $
        X[IDxL,LD2+iLy*L] = 0.25*( X[IDxL,iLy*L] + X[IDxL,iLy*L+L] +
X[IDxL-LD2,LD2+iLy*L] + X[IDxLD2,LD2+iLy*L] ) + STD*RANDOMN(SEED,nL)
   ENDIF


;*****************************************************
;**     Halve the scale for the next iteration     **
;*****************************************************

   L = L/2
   LD2 = LD2/2
   nL = nL*2

   IDxL   = INDGEN(nL)*L
   IDxLD2 = IDxL + LD2
   IDxLPL = IDxL + L
   IDxLnX = [ IDxL , nX ]

   ; Update the previously calculated points

   FOR iLy = 0 , nL DO $
      X[IDxLnX,iLy*L] = X[IDxLnX,iLy*L] + STD*RANDOMN(SEED,nL+1)

   Var = Var * SQRT(0.5)^(2.0*H)          ; adjust variance
;    IF i EQ 7 THEN Var = Var*0.9
;    IF i EQ 8 THEN Var = Var*0.85
;    IF i EQ 9 THEN Var = Var*0.5
   STD = SQRT(Var)


ENDFOR

RETURN, X

END
------------------------
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy