Solved


Add two numbers
Given a and b, return the sum a+b in c.

10 years ago

Solved


Which doors are open?
There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

10 years ago

Solved


Solve the Sudoku Row
*Description* A simple yet tedious task occurs near the end of most Sudoku-solving algorithms, computerized or manual. The ta...

10 years ago

Solved


Triangle sequence
A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

10 years ago

Solved


Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

10 years ago

Solved


Return the 3n+1 sequence for n
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...

10 years ago

Solved


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

10 years ago

Answered
Using convolution to determine pdf of adding two triangular random variables
The |conv| function is essentially doing a numerical integration over |x|. It is not necessary that both pdfs be based on the sa...

10 years ago | 1

Answered
filling the first NaN right after the last non NaN with a value that is half of the non NaN
You can use the function |isnan| to find the appropriate values to replace as in the following code: p = [ NaN 2...

10 years ago | 0

Question


A Simulink.findVars equivalent for elements of a structure
The parameters used in my Simulink model are organized into a many-level structure. I would like to find out which of the elemen...

10 years ago | 1 answer | 0

1

answer

Question


How to best randomize Simulink Random Number seeds for Rapid Accelerator simulation
I have a large model that I would like to execute iteratively in rapid simulation mode inside a parfor loop. The model contains ...

10 years ago | 0 answers | 0

0

answers

Answered
I am trying to create a 5x5 array. How will I achieve this by using a nested loop?
The array you asked for can be created without a nested loop. Try: (1:5)'*(1:5) The enclosed statement, |(1:5)|, creates...

10 years ago | 0

Answered
Can I use if ..break...else inside the same loop?
Your code looks fine. However, you can simplify the structure by adding |target = 0;| before your loop and omitting the else sta...

10 years ago | 1

| accepted

Answered
appending an empty list
The behavior of |append| is specific to the data types input to it. For the basic types, you are probably better off using ...

10 years ago | 2

Answered
How to plot a function against a matrix?
I am assuming you mean to find the values of your function |g(x)| over all values defined in |r2|. If |a|, |b|, and |c| are scal...

10 years ago | 0

Answered
Hide all elements of an axis
In MATLAB R2015a, Legends are children of the figure, not the axes. For example, I expect you will be able to find the legend wi...

10 years ago | 0

| accepted

Answered
How can I prevent the sim command from bringing the model to the top?
I am running MATLAB R2015a on Windows 7 and the |sim| command doesn't bring my model into focus. What version of MATLAB are you ...

10 years ago | 0

Answered
How to wait for an event without stopping the program?
You could accomplish this with a |timer| object. When a name is selected, use the callback to create and start a timer with |Exe...

10 years ago | 0

| accepted

Answered
error - "Attempted to access w(0.000542549); index must be a positive integer or logical."
Just before your final |end| statement you have the line H0 = mod(1+cos(w(rho_d+rho_D)),0)/2 The error occurs when MATLA...

10 years ago | 0

| accepted

Question


How can I tell Simulink Embedded Coder to get its variable names from my signal names, not the source block names?
I am generating C code from a Simulink model using Simulink Embedded Coder with the ERT target. I can see that the variable name...

10 years ago | 1 answer | 4

1

answer

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

10 years ago

Solved


Say something funny
Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

10 years ago

Solved


Return the Nth Output from an Input Command
*Description* Given _F_, a cell array whose first element is a function handle and subsequent elements are arguments, return ...

10 years ago

Solved


Find the numeric mean of the prime numbers in a matrix.
There will always be at least one prime in the matrix. Example: Input in = [ 8 3 5 9 ] Output out is 4...

10 years ago

Solved


Find the longest sequence of 1's in a binary sequence.
Given a string such as s = '011110010000000100010111' find the length of the longest string of consecutive 1's. In this examp...

10 years ago

Solved


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

10 years ago

Solved


Read a Soroban Abacus
*Description* The Soroban is the name of the modern Japanese abacus. Information on reading a Soroban can be found <http://we...

10 years ago

Solved


Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; and ...

10 years ago

Solved


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

10 years ago

Solved


Function Iterator
Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

10 years ago

Load more