Solved

Triangle Numbers

Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

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

12 years ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

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

12 years ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

12 years ago

Solved

Find all elements less than 0 or greater than 10 and replace them with NaN

Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

12 years ago

Solved

Determine if input is odd

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

12 years ago

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

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

12 years ago

Solved

Times 2 - START HERE

Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

12 years ago

Answered

Using 'From Multimedia File', how to split the channels

Demux only works with vectors, but this signal is a matrix. You can use two Selector blocks. Set the input dimensions to 2, sele...

Using 'From Multimedia File', how to split the channels

Demux only works with vectors, but this signal is a matrix. You can use two Selector blocks. Set the input dimensions to 2, sele...

13 years ago | 0

Answered

pass a parameter to a masked subsystem

Here are two options: 1. Calculate the derived values directly in the blocks that need them in the subsystem. For example, ma...

pass a parameter to a masked subsystem

Here are two options: 1. Calculate the derived values directly in the blocks that need them in the subsystem. For example, ma...

13 years ago | 0

Answered

Boolean Filter

This sounds similar to a debounce circuit. Here are some other related answers that should help you: * <http://www.mathworks....

Boolean Filter

This sounds similar to a debounce circuit. Here are some other related answers that should help you: * <http://www.mathworks....

13 years ago | 0

Answered

SimPowerSys: Modify the Asynchronous machine

The blocks underneat the Asynchronous machine (Mechanical model, Electrical model) are what's know as <http://www.mathworks.com/...

SimPowerSys: Modify the Asynchronous machine

The blocks underneat the Asynchronous machine (Mechanical model, Electrical model) are what's know as <http://www.mathworks.com/...

13 years ago | 2

Answered

signal builder: repeat a signal for n times in one simulation (not to be confused with running in succession)

Currently the only options for extending the signal beyond the time range in which it is defined in the Signal Builder block are...

signal builder: repeat a signal for n times in one simulation (not to be confused with running in succession)

Currently the only options for extending the signal beyond the time range in which it is defined in the Signal Builder block are...

13 years ago | 0

Answered

Simulate potency

Rather than a regular Resistor block, put a Current Sensor in series with a Variable Resistor. Square the measured current using...

Simulate potency

Rather than a regular Resistor block, put a Current Sensor in series with a Variable Resistor. Square the measured current using...

13 years ago | 0

Answered

Difference between setappdata and guidata?

You can look at the code for GUIDATA by typing edit guidata You'll notice that GUIDATA calls SETAPPDATA, it just provide...

Difference between setappdata and guidata?

You can look at the code for GUIDATA by typing edit guidata You'll notice that GUIDATA calls SETAPPDATA, it just provide...

13 years ago | 2

Answered

measure data size in simulink

Also, if you need that value as a signal in the Simulink model you can use the <http://www.mathworks.com/help/releases/R2011a/to...

measure data size in simulink

Also, if you need that value as a signal in the Simulink model you can use the <http://www.mathworks.com/help/releases/R2011a/to...

13 years ago | 1

| accepted

Answered

My functions Won't Share Variables

You can share the workspace of the main GUI function with the subfunctions fun1-5 by making those subfunctions <http://www.mathw...

My functions Won't Share Variables

You can share the workspace of the main GUI function with the subfunctions fun1-5 by making those subfunctions <http://www.mathw...

13 years ago | 0

Answered

How do I display a MATLAB error from a Simulink Model?

You could also use the the blocks in the Model Verification library, such as <http://www.mathworks.com/help/releases/R2011a/tool...

How do I display a MATLAB error from a Simulink Model?

You could also use the the blocks in the Model Verification library, such as <http://www.mathworks.com/help/releases/R2011a/tool...

13 years ago | 1

Answered

How to detect sequence signal explicitly

If you are using R2010a or later you can use the Relational Operator block in Logic and Bit Operations to compare the vector V a...

How to detect sequence signal explicitly

If you are using R2010a or later you can use the Relational Operator block in Logic and Bit Operations to compare the vector V a...

13 years ago | 1

| accepted

Answered

Hold True Value for finite length of time

The easiest solution is using Stateflow: create two states off and on, transition from off to on when the signal is tripped, the...

Hold True Value for finite length of time

The easiest solution is using Stateflow: create two states off and on, transition from off to on when the signal is tripped, the...

13 years ago | 1

| accepted

Answered

save the variables whose names are always changing over different loops

If you are saving each value to disk as a separate file, the only thing you need to change is the filename. You can reuse the sa...

save the variables whose names are always changing over different loops

If you are saving each value to disk as a separate file, the only thing you need to change is the filename. You can reuse the sa...

13 years ago | 1

| accepted

Answered

Distribution sampling

I'm not a statistics expert but I believe randomly sampling a set of data should come close to preserving the distribution and c...

Distribution sampling

I'm not a statistics expert but I believe randomly sampling a set of data should come close to preserving the distribution and c...

13 years ago | 0

Answered

How do I run a simulation with a transfer function block and a multi dimensional input ?

Another option is to discretize the transfer function because a discrete transfer function does allow a vector input signal. ...

How do I run a simulation with a transfer function block and a multi dimensional input ?

Another option is to discretize the transfer function because a discrete transfer function does allow a vector input signal. ...

13 years ago | 4

Answered

Numerical difference between Matlab result and MS Excel result

When I type '123456789123456789' in a numeric field in Excel, I get 123456789123456000. The issue is due to floating point data ...

Numerical difference between Matlab result and MS Excel result

When I type '123456789123456789' in a numeric field in Excel, I get 123456789123456000. The issue is due to floating point data ...

13 years ago | 1

Answered

Weird imshow image. same pixel value different color

C is double so the default range for imshow is between 0 and 1, but your values are between 0 and 255. You can either specify th...

Weird imshow image. same pixel value different color

C is double so the default range for imshow is between 0 and 1, but your values are between 0 and 255. You can either specify th...

13 years ago | 1

| accepted

Answered

Not sensible to short time FALSE

It sounds like you are trying to create debounce logic where you only want to go low if the input is held low for a certain peri...

Not sensible to short time FALSE

It sounds like you are trying to create debounce logic where you only want to go low if the input is held low for a certain peri...

13 years ago | 0

Answered

Choose elements, matrix with fewer elements

function y = myFun(a,b) aN = numel(a); bN = numel(b); % Make sure a is smaller if aN>bN temp ...

Choose elements, matrix with fewer elements

function y = myFun(a,b) aN = numel(a); bN = numel(b); % Make sure a is smaller if aN>bN temp ...

13 years ago | 0

| accepted