Solved

Related Vectors

I have two vectors A & B. If the values in vector A is zero then the corresponding value in vector B should be zero. Example:...

2 months ago

Solved

Matlab Basics II - Max & Index of Max

Write a function that takes a vector x, then returns both the max value in x and its location in the vector for example x ...

2 months ago

Solved

Determine the length of a string of characters

Determine the length of a string of characters

2 months ago

Solved

Deleting an element in a matrix

For vector Grades=[98 56 78 34 100 88 87], delete the number 78 to get the following matrix Grades=[98 56 34 100 88 87] **re...

2 months ago

Solved

Program an exclusive OR operation with logical operators

Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...

2 months ago

Solved

Duplicate a character

Duplicate a character 'n' times. Example 1: str='a' n=5 output='aaaaa' Example 2: str='*' n=3 output='***'

2 months ago

Solved

Make a 1 hot vector

Make a vector of length _N_ that consists of all zeros except at index _k_, where it has the value 1. Example: Input ...

2 months ago

Solved

Matlab Basics II - Free Fall

An object freely falling from rest under gravity covers a distance x given by: x = 1/2 gt^2 write a function that calculat...

2 months ago

Solved

03 - Matrix Variables 2

Make the following variable: <<http://samle.dk/STTBDP/Assignment1_3b.png>> A 9x9 matrix of zeros, but with the following v...

2 months ago

Solved

middleAsColumn: Return all but first and last element as a column vector

Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

2 months ago

Solved

All capital?

Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

2 months 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]

2 months ago

Solved

Back to basics 13 - Input variables

Covering some basic topics I haven't seen elsewhere on Cody. Return as a string the name of the input variable to the functio...

2 months 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...

2 months ago

Solved

Mode

Find the mode of the vector Assumption: no vector is bimodal Example 1: input=[1 2 3 4 4]; output=4 Example 2: input=[7...

2 months ago

Solved

Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]

The given function returns the index of the maximum value in a given matrix. such as X=[4,3,4,5,9,12,0,5] Ans= 6 if maxim...

2 months ago

Solved

Sum of the Matrix Elements

Add up all the elements in a NxM matrix where N signifies the number of the rows and M signifies the number of the columns. E...

2 months ago

Solved

Remove the two elements next to NaN value

The aim is to *remove the two elements next to NaN values* inside a vector. For example: x = [6 10 5 8 9 NaN 23 9 7 3 21 ...

2 months ago

Solved

Determine the mean of matrix

Determine the mean of matrix without using mean function Hint: use simple algorithm

2 months ago

Solved

Return 'on' or 'off'

When the input is true, return 'on', otherwise, return 'off'.

2 months ago

Solved

Is my wife right? Now with even more wrong husband

Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

2 months ago

Solved

Sum of first n positive integers

Given n, find the sum of first n positive integers Example: If n=10, then x=1,2,3,4,5,6,7,8,9,10. The sum of these terms is 55

2 months ago

Solved

No Twins?

Write a function that accepts as input a vector and returns the same vector, but retaining only the first occurrence of an eleme...

2 months ago