economia news e media viaggi informatica internet salute e benessere int rattenimento e spettacolo sport tempo libero istruzio ne e formazione arte cultura scienza

I link preferiti della guida

Il Sondaggio

Che cosa cerchi?

Guarda i risultati

Esercizi Matlab

Esercizi sui costrutti per i cicli

A cura di Giuseppe Ciaburro

Pubblicato il 27/12/2007

In questi esercizi si imparerà ad utilizzare i cicli in Matlab

SOMMARIO

 

1.Given the vector x = [1 8 3 9 0 1], create a short set of commands that will

   a. Add up the values of the elements (Check with sum.)
   b. Computes the running sum (for element j, the running sum is the sum of the
      elements from 1 to j, inclusive.  Check with cumsum.)
   c. computes the sine of the given x-values (should be a vector)
    ans.
  
2. Create an M-by-N array of random numbers (use rand).  Move through the
   array, element by element, and set any value that is less than 0.2 to 0 and any
   value that is greater than (or equal to) 0.2 to 1. 
    ans.
  
3. Given x = [4 1 6] and y = [6 2 7], compute the following arrays

   a. aij = xiyj
   b. bij = xi/yj
   c. ci = xiyi, then add up the elements of c.
   d. dij = xi/(2 + xi + yj)
   e. eij = reciprocal of the lesser of xi and yj
    ans.

CONTINUA

 

Vuoi essere aggiornato sulle novità della guida?

Feed RSS XML vostro feed RSS