Answered

How to move elements of vector

i can't think of how you might do this without a loop and maintain the matrix form. but your approach will work row-by-row for ...

How to move elements of vector

i can't think of how you might do this without a loop and maintain the matrix form. but your approach will work row-by-row for ...

1 month ago | 1

Answered

Roll a 6-Sided Die and Compute the Probability of the Sum (with bar graph)

rng('shuffle') N = 1000; % total number of rolls you want rollz=NaN(N,1); for k=1:N; rollz(k) = sum( randi([1 6],2,1) )...

Roll a 6-Sided Die and Compute the Probability of the Sum (with bar graph)

rng('shuffle') N = 1000; % total number of rolls you want rollz=NaN(N,1); for k=1:N; rollz(k) = sum( randi([1 6],2,1) )...

3 months ago | 0

Question

simulink/simscape final state 'cannot find a matching block state to element 135' output by the same model

I have a model that contains some simulink and simcape model. The gist is: initail simulation from T0 to T1, perfrom some ana...

4 months ago | 2 answers | 0

Question

generating/extracting a simulink restart state from system output? ?problem with 'discrete' blocks?

I need to periodically interrupt a SIMULINK model, and restart it with the the state it was in at some previous time (with some ...

4 months ago | 1 answer | 4

Question

'keyboard' calls fail outside try..catch when try..catch contains a keyboard call

R2020a. this is driving me nuts this morning. function dummyout = check_kb(DUMMYARG) fprintf('check which keyboard\n') whi...

4 months ago | 1 answer | 0

Question

how to disable the CLI prompt to save simulink model before closing?

I'm calling simulink through non-GUI shell. Any error or interruption of the model (eg. Ctrl+c) seems to bring up an infinite ...

5 months ago | 1 answer | 1

Answered

How to do the following matrix multiplication and division?

(1 - Oscillator_frequency^2 / Frequency.^2)) this slash needs to be a './' or it's interpreted as a matrix inverison... htat's ...

How to do the following matrix multiplication and division?

(1 - Oscillator_frequency^2 / Frequency.^2)) this slash needs to be a './' or it's interpreted as a matrix inverison... htat's ...

5 months ago | 1

| accepted

Answered

how do you program the file path when you do not know where the person will save the matlab file you send them?

DIRS = dir('**/beam.tiff'); % gets a structured list of matching files % ... % additional criterion here to choose which to pi...

how do you program the file path when you do not know where the person will save the matlab file you send them?

DIRS = dir('**/beam.tiff'); % gets a structured list of matching files % ... % additional criterion here to choose which to pi...

8 months ago | 0

Question

why isn't simulink seeing a workspace variable for initial state unless it's global?

I have a wrapper around a simulink code that i'm calling functionally. A dumbed down (not MWE, just an easier to present it tha...

9 months ago | 0 answers | 0

Answered

How to make each component a string in one whole string?

depends on how you want your output, but i'd use the split function and then cast the returned cell into a string array Snew = ...

How to make each component a string in one whole string?

depends on how you want your output, but i'd use the split function and then cast the returned cell into a string array Snew = ...

9 months ago | 0

Question

how can i programmatically set and adjust initial conditions in simulink the right way?

I have a simulink model to which i'm trying to implement tracking/control algorithm by re-initialization: I run the model, apply...

9 months ago | 0 answers | 2

Answered

Simple question regarding "distance" function

from that link, it looks like the distance function is part of a toolbox. in my 2019b, distance is available from several toolb...

Simple question regarding "distance" function

from that link, it looks like the distance function is part of a toolbox. in my 2019b, distance is available from several toolb...

10 months ago | 0

Question

simulink sensitivity analysis stops using multiple cpus, not running parallel jobs correctly

i'm running a simulink model with the sensitiity analysis tools in R2019b via gui. running ubuntu 18.04 on a 24cpu workstation...

10 months ago | 0 answers | 0

Answered

Set a new colormap

It should be as easy as calling something like cmap = cmocean('thermal'); % or 'deep', or whichever colormap from the collecti...

Set a new colormap

It should be as easy as calling something like cmap = cmocean('thermal'); % or 'deep', or whichever colormap from the collecti...

11 months ago | 1

| accepted

Solved

Binary numbers

Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n...

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

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

1 year ago

Solved

Pizza!

Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

1 year 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]; ...

1 year ago

Solved

Determine if input is odd

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

1 year ago

Answered

Simulink does not support loading the input data in file

It seems like there is also a problem with broadcasting between column and row vectors even after saving -v7.3 and converting to...

Simulink does not support loading the input data in file

It seems like there is also a problem with broadcasting between column and row vectors even after saving -v7.3 and converting to...

1 year ago | 0

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

1 year ago