106 total contributions since 2012

Software developer on embedded control and instrument system since 1983. Matlab user since 2000.

Solved

Make the vector [1 2 3 4 5 6 7 8 9 10]

In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

3 years ago

Solved

Bottles of beer

Given an input number representing the number of bottles of beer on the wall, output how many are left if you take one down and ...

6 years ago

Solved

Project Euler: Problem 1, Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

6 years ago

Solved

radius of a spherical planet

you just measured its surface area, that is the input.

6 years ago

Solved

Roll the Dice!

*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

6 years ago

Solved

Swap the input arguments

Write a two-input, two-output function that swaps its two input arguments. For example: [q,r] = swap(5,10) returns q = ...

6 years ago

Solved

Too mean-spirited

Find the mean of each consecutive pair of numbers in the input row vector. For example, x=[1 2 3] ----> y = [1.5 2.5] x=[1...

6 years ago

Solved

Distance walked 1D

Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

6 years ago

Solved

How to find the position of an element in a vector without using the find function

Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

6 years ago

Solved

Sum all integers from 1 to 2^n

Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

6 years ago

Solved

Mandelbrot Numbers

The <http://en.wikipedia.org/wiki/Mandelbrot_set Mandelbrot Set> is built around a simple iterative equation. z(1) = c z...

7 years ago

Question

How to generate a PDF tuning report containing text and figures?

I am using a MATLAB script to tune a control system. When the tuning is complete, I would like a report containing text (especia...

7 years ago | 0 answers | 1

Solved

Word Counting and Indexing

You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

7 years ago

Answered

How to debug SOAP message from matlab

I have taken this from an answer I put on StackOverflow. Here is an example of a successful web service query. msg = c...

How to debug SOAP message from matlab

I have taken this from an answer I put on StackOverflow. Here is an example of a successful web service query. msg = c...

7 years ago | 0

Solved

It dseon't mettar waht oedrr the lrettes in a wrod are.

An internet meme from 2003 (read more <http://www.snopes.com/language/apocryph/cambridge.asp here>) asserted that readers are re...

7 years ago

Solved

Knight's Tour Checker

Given a matrix a, determine whether or not a legal <http://en.wikipedia.org/wiki/Knight's_tour knight's tour> is present. The kn...

7 years ago

Solved

Find the peak 3n+1 sequence value

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

7 years ago

Solved

Find state names that end with the letter A

Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

7 years ago

Solved

Find the two-word state names

Given a list of states, remove all the states that have two-word names. If s1 = 'Alabama Montana North Carolina Vermont N...

7 years ago

Solved

Tic Tac Toe FTW

Given a tic tac toe board: * 1 represents X * 0 represents empty. * -1 represents O It is X's move. If there is an imme...

7 years ago

Solved

Find state names that start with the letter N

Given a list of US states, remove all the states that start with the letter N. If s1 = 'Alabama Montana Nebraska Vermont Ne...

7 years ago

Solved

Clean the List of Names

Given a list of names in a cell array, remove any duplications that result from different capitalizations of the same string. So...

7 years ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

7 years ago

Solved

Counting in Finnish

Sort a vector of single digit whole numbers alphabetically by their name, in Finnish. See the Wikipedia page for <http://en.wik...

7 years ago

Solved

Subset Sum

Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. I...

7 years ago

Solved

Test for balanced parentheses

Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

7 years ago

Solved

Find common elements in matrix rows

Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

7 years ago

Solved

Renaming a field in a structure array

MATLAB has a <http://www.mathworks.com/help/techdoc/ref/setfield.html setfield> and a <http://www.mathworks.com/help/techdoc/ref...

7 years ago

Solved

Implement a ROT13 cipher

Replace each character in string s1 with the character that is shifted 13 positions from it (wrap back to the beginning if neces...

7 years ago