commodity risk management

Solved

Approximate the cosine function

Without using MATLAB trigonometric functions, calculate the cosine of an argument |x| to a precision of |0.0001| *Hint:* You ...

8 jours ago

Solved

Vector push

Append an element |x| to the end of the vector |v| and return both the extended vector and the new number of its elements. |x| c...

8 jours ago

Solved

Find the average of a random sequance

Write a function that generates random integers within a loop, and calculates the mean of the positive numbers only. At each ...

8 jours ago

Solved

Guess the number I'm thinking of

In this game you are competing against two other people to guess the number that I'm thinking of. # I randomly choose an *i...

27 jours ago

Solved

vectorization in N

For a given integer n (n>1), compute the sum f (i) (1 <= i <= n) where f (i) = 1 if n is odd and 2 otherwise.

environ un mois ago

Solved

Volume of this donut

Given hole diameter a, and outermost diameter b, determine the volume y of the resulting donut.

environ un mois ago

Solved

Triangle Numbers Below N

This is an offshoot of <http://www.mathworks.com/matlabcentral/cody/problems/5-triangle-numbers Cody Problem 5: Triangle Numbers...

environ un mois ago

Solved

Project Euler: Problem 5, Smallest multiple

2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smalle...

environ un mois ago

Solved

Find the biggest empty box

You are given a matrix that contains only ones and zeros. Think of the ones as columns in an otherwise empty floor plan. You wan...

environ un mois ago

Solved

Calculate the derivative of a polynomial

Example: in = [ 1 1 1 ] out = [ 2 1 ]

environ 2 mois ago

Solved

Matlab Basics II - squares

Write a function that takes matrix A, and squares each element in the matrix example: A = [1 2 3] output = [1 4 9]

environ 2 mois ago

Solved

The Answer to Life, the Universe, and Everything

A variation of a previous Hitchhiker's Guide to the Galaxy problem. *Inputs:* Life, the Universe, and Everything *Output:*...

environ 2 mois ago

Solved

What percentage?

Calculate the output c as the percentage of a on b for given a and b.

environ 2 mois ago

Solved

Stuff the Board

You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

environ 2 mois ago

Solved

Number of odd and even elements within matrix

Input(m) - any matrix with integers Output(n) - n(1)=number of odd elements, n(2)=number of even elements Example: * m=...

environ 2 mois ago

Solved

Remove from a 2-D matrix all the rows that contain at least one element less than or equal to 4

Example: in = magic(5) in = 17 24 1 8 15 23 5 7 14 16 4 6 13 20 ...

environ 2 mois ago

Solved

If-then-else

Complete the function below such that if the value of x is in the range 10 to 14, inclusive, the value 18 is assigned to y. Oth...

environ 2 mois ago

Solved

Sum of diagonals elements of a matrix

Given a matrix, return the sum of all the elements across the diagonals. E.g. A = [1 2 3; 4 5 6; 7 8 9;...

environ 2 mois ago

Solved

Back to basics 25 - Valid variable names

Covering some basic topics I haven't seen elsewhere on Cody. Given a string, return true if it is a valid MATLAB variable nam...

environ 2 mois ago

Solved

Wind Chill Computation

On a windy day, a temperature of 15 degrees may feel colder, perhaps 7 degrees. The formula below calculates the "wind chill," i...

environ 2 mois ago

Solved

Remove entire row and column in the matrix containing the input values

Remove the entire row and column from the matrix containing specific values. The specified value can be a scalar or a vector. Fo...

environ 2 mois ago

Solved

Sort complex numbers into complex conjugate pairs

Sort complex numbers into complex conjugate pairs. Example: Input x = [3-6i -1-4i -1+4i 3+6i] Sorted output = [-1 - ...

environ 2 mois ago

Solved

Count photos

Given n people, everyone must have pictures taken with everyone, each photo includes only two persons, please count the total nu...

environ 2 mois ago

Solved

Change the sign of even index entries of the reversed vector

change the signs of the even index entries of the reversed vector example 1 vec = [4 -1 -2 9] ans = [9 2 -1 -4] example2...

environ 2 mois ago

Solved

Derivative of polynomial

Compute the derivative of a given polynomial. The input is an <http://www.mathworks.com/help/matlab/math/representing-polynomial...

environ 2 mois ago

Solved

Matlab Basics - Pick out parts of a vector

Consider x a vector of length >= 7 (there are at least 7 elements in the vector, write a script that extracts the 2nd element, a...

environ 2 mois ago

Solved

03 - Matrix Variables 5

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3e.png>>

environ 2 mois ago

Solved

Distance walked 3D

suppose you go from x-y-z coordinates [3,4,2] to [0,0,2] to [0,1,2] to [1,1,2], to [1,1,20] then you walked 25 units of distance...

2 mois ago