Answered

3x3 matrix with while loop

n = 3; m = 3; A = zeros(n,m); while det(A) == 0 A = rand(n,m); end

3x3 matrix with while loop

n = 3; m = 3; A = zeros(n,m); while det(A) == 0 A = rand(n,m); end

3 days ago | 0

Answered

quick reference guide for plotting

https://www.mathworks.com/help/matlab/ref/plot.html#btzitot-LineSpec

quick reference guide for plotting

https://www.mathworks.com/help/matlab/ref/plot.html#btzitot-LineSpec

3 days ago | 0

| accepted

Answered

input multi workspaces in function

Put the data into one array, pass it into the function, and parse the array inside the function?

input multi workspaces in function

Put the data into one array, pass it into the function, and parse the array inside the function?

3 days ago | 0

Answered

How can I run Simulink 'Build model' from the command line

I'm not sure if I'm understanding your use case completely, but I think you are looking for sim? sim('modelname.slx'); If that...

How can I run Simulink 'Build model' from the command line

I'm not sure if I'm understanding your use case completely, but I think you are looking for sim? sim('modelname.slx'); If that...

21 days ago | 0

Answered

Replace all instances of a value with random number

A = [0 1 0 1; 1 0 1 1; 0 0 1 1]; id = A==1; r = rand(1,nnz(id)); A(id) = r;

Replace all instances of a value with random number

A = [0 1 0 1; 1 0 1 1; 0 0 1 1]; id = A==1; r = rand(1,nnz(id)); A(id) = r;

22 days ago | 0

| accepted

Answered

How to remove the table size below the table header; e.g., get rid of --> " 1×7 table "

The 1x7 table is not part of the table, it's part of the default display when you type a variable name with no formatting, you c...

How to remove the table size below the table header; e.g., get rid of --> " 1×7 table "

The 1x7 table is not part of the table, it's part of the default display when you type a variable name with no formatting, you c...

24 days ago | 1

Answered

how to keep labels in matlab with multiplotyyy function ?

x = linspace(1,10,201); y1 = x.^2; y2 = log(x); pyh = plotyy(x,y1,x,y2); legend('x^2','ln(x)') ax = gca; xlabel('x') ax.X...

how to keep labels in matlab with multiplotyyy function ?

x = linspace(1,10,201); y1 = x.^2; y2 = log(x); pyh = plotyy(x,y1,x,y2); legend('x^2','ln(x)') ax = gca; xlabel('x') ax.X...

24 days ago | 0

Answered

Matrix Shifting: columns to single row

A = [1 2 3; 4 5 6; 7 8 9] B = reshape(A',[1,numel(A)])

Matrix Shifting: columns to single row

A = [1 2 3; 4 5 6; 7 8 9] B = reshape(A',[1,numel(A)])

1 month ago | 0

| accepted

Answered

Can the diff function go the opposite direction?

sure, flip your matrix with fliplr or flipud and then run diff

Can the diff function go the opposite direction?

sure, flip your matrix with fliplr or flipud and then run diff

1 month ago | 0

| accepted

Answered

"Index exceeds the number of array elements (217)"

If you have 217 rows and you're trying to index row 478 then Matlab will throw an error also, the ,1 will need to be outside ...

"Index exceeds the number of array elements (217)"

If you have 217 rows and you're trying to index row 478 then Matlab will throw an error also, the ,1 will need to be outside ...

1 month ago | 0

| accepted

Answered

How to find values in a range and save them to different arrays, repeatedly

target_times= randi(120000,1,64); bins = 10000:10000:120000; c = cell(12,1); c{1} = target_times(target_times < bins(1)); fo...

How to find values in a range and save them to different arrays, repeatedly

target_times= randi(120000,1,64); bins = 10000:10000:120000; c = cell(12,1); c{1} = target_times(target_times < bins(1)); fo...

1 month ago | 0

| accepted

Answered

Indexing portions of a vector with array

I had to think about this for a while, but I think that this accomplishes the task you are looking for a = 1:12; id_start = [4...

Indexing portions of a vector with array

I had to think about this for a while, but I think that this accomplishes the task you are looking for a = 1:12; id_start = [4...

1 month ago | 0

Answered

Having issues with a function: creates NxN matrix instead of a column vector

Are the inputs p, sigma, N scalar values or vectors? Does normrnd return a vector or a scalar? That seems to be a function you w...

Having issues with a function: creates NxN matrix instead of a column vector

Are the inputs p, sigma, N scalar values or vectors? Does normrnd return a vector or a scalar? That seems to be a function you w...

1 month ago | 0

Answered

Interval where values are greater than treshold

I believe you are looking for the find command. find(Logic)

Interval where values are greater than treshold

I believe you are looking for the find command. find(Logic)

1 month ago | 0

Answered

How can I shade confidence intervals and assign colors to frequency spectra plot (pwelch)

The plot commands accept a 3 element vector in place of the built-in colors, each element being a number between 0 and 1 represe...

How can I shade confidence intervals and assign colors to frequency spectra plot (pwelch)

The plot commands accept a 3 element vector in place of the built-in colors, each element being a number between 0 and 1 represe...

2 months ago | 0

Answered

Add error bars to grouped bar plot

Like this? https://www.mathworks.com/help/matlab/creating_plots/bar-chart-with-error-bars.html

Add error bars to grouped bar plot

Like this? https://www.mathworks.com/help/matlab/creating_plots/bar-chart-with-error-bars.html

2 months ago | 0

Answered

How map values of array to 0 and 1

normalized_array = normalize(array,'range',[0 1]);

How map values of array to 0 and 1

normalized_array = normalize(array,'range',[0 1]);

2 months ago | 1

Answered

Brace indexing is not supported for variables of this type

Mu_s{:} < 1.0 && Mu_d{:} < 7.0

Brace indexing is not supported for variables of this type

Mu_s{:} < 1.0 && Mu_d{:} < 7.0

2 months ago | 0

Answered

Using now() in different time zones (or with daylight saving time)

From the documentation for now Limitations MATLAB Online returns the current date and time in Coordinated Universal Time (UTC...

Using now() in different time zones (or with daylight saving time)

From the documentation for now Limitations MATLAB Online returns the current date and time in Coordinated Universal Time (UTC...

2 months ago | 0

Answered

Having an array V from 0 to 44.8 in steps of 0.01, I try to use the function find(V == 30) and I get and empty array. Why?

I suspect this is a case of roundoff error. A workaround would be find(Volt > 29.999 & Volt < 30.001); Using whatever toleranc...

Having an array V from 0 to 44.8 in steps of 0.01, I try to use the function find(V == 30) and I get and empty array. Why?

I suspect this is a case of roundoff error. A workaround would be find(Volt > 29.999 & Volt < 30.001); Using whatever toleranc...

2 months ago | 0

Answered

The code runs, but imediately deletes the animation and does not update

delete(P1_pos_cir); delete(P2_pos_cir); delete(P3_pos_cir); delete(P4_pos_cir); delete(P5_pos_cir); ...

The code runs, but imediately deletes the animation and does not update

delete(P1_pos_cir); delete(P2_pos_cir); delete(P3_pos_cir); delete(P4_pos_cir); delete(P5_pos_cir); ...

2 months ago | 0

Answered

Confusion manipulating timestamp and plotting

Is each number supposed to represent a datetime as a "datenum" data type? t = 0.0517361112797516; d = datetime(t,'ConvertFrom'...

Confusion manipulating timestamp and plotting

Is each number supposed to represent a datetime as a "datenum" data type? t = 0.0517361112797516; d = datetime(t,'ConvertFrom'...

2 months ago | 0

Answered

How to include string + numbers in a table using a for...end routine

It sounds like you might want to use the command readtable This will read your entire spreadsheet as a table data type

How to include string + numbers in a table using a for...end routine

It sounds like you might want to use the command readtable This will read your entire spreadsheet as a table data type

2 months ago | 0

Answered

Error while using writematrix to save complex values in a .txt

csvwrite Does this correctly. I will look into writematrix

Error while using writematrix to save complex values in a .txt

csvwrite Does this correctly. I will look into writematrix

2 months ago | 1

| accepted

Answered

Warning: Executing startup failed in matlabrc. This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was: MATLAB:calllib:MethodNotFound Method was not found.

Did you move or delete a file or rename one of the Matlab directories?

Warning: Executing startup failed in matlabrc. This indicates a potentially serious problem in your MATLAB setup, which should be resolved as soon as possible. Error detected was: MATLAB:calllib:MethodNotFound Method was not found.

Did you move or delete a file or rename one of the Matlab directories?

2 months ago | 0

| accepted

Answered

Using fzero to solve an equation with different constants every time

x0=[0;1]; By passing a vector into fzero you are telling it that you think the solution is between these values, so it will sta...

Using fzero to solve an equation with different constants every time

x0=[0;1]; By passing a vector into fzero you are telling it that you think the solution is between these values, so it will sta...

2 months ago | 0

| accepted

Answered

How do I get the date out of a filename using regexp?

str = 'xxx_2014_06_03_00_00_01'; id = regexp(str,'\d') Returns: id = 5 6 7 8 10 11 13 14 16 ...

How do I get the date out of a filename using regexp?

str = 'xxx_2014_06_03_00_00_01'; id = regexp(str,'\d') Returns: id = 5 6 7 8 10 11 13 14 16 ...

2 months ago | 0

Answered

Solving non-linear equation including natural logarithm

Most probably, there is no analytical solution for y in terms of (a,b,c,x). You can solve numerically for y at given values of a...

Solving non-linear equation including natural logarithm

Most probably, there is no analytical solution for y in terms of (a,b,c,x). You can solve numerically for y at given values of a...

2 months ago | 0

Answered

how to mathematical modelling the solar PV in Simulink?

Hi, The "sum" block in the "Photo Current" subsystem is meant to be +/- according to the model - your current setup has a +/+. ...

how to mathematical modelling the solar PV in Simulink?

Hi, The "sum" block in the "Photo Current" subsystem is meant to be +/- according to the model - your current setup has a +/+. ...

2 months ago | 0

Answered

How can I extract a certain numerical value from a text file?

I have written a similar function - something along the lines of fopen(fid) while feof ~= 1 str = fgetl(fid); if str...

How can I extract a certain numerical value from a text file?

I have written a similar function - something along the lines of fopen(fid) while feof ~= 1 str = fgetl(fid); if str...

2 months ago | 1

| accepted