Answered

Adding underscore in xlabel latex interpreter

Are you looking for something like this xlabel('$L_{{(ex)}_L}$','fontweight','bold','FontSize',20,'Interpreter','latex');

Adding underscore in xlabel latex interpreter

Are you looking for something like this xlabel('$L_{{(ex)}_L}$','fontweight','bold','FontSize',20,'Interpreter','latex');

20 hours ago | 0

| accepted

Answered

How to output zeros from a matrix with corresponding matrix of indices for those indeces which are 0 or with negative sign ?

Something like this will work A = [ 0 -1 1 0 2 1 3 2]; B = [1 5 10]; C = zeros(size(A)); C(A>0) = B(A(A>0))

How to output zeros from a matrix with corresponding matrix of indices for those indeces which are 0 or with negative sign ?

Something like this will work A = [ 0 -1 1 0 2 1 3 2]; B = [1 5 10]; C = zeros(size(A)); C(A>0) = B(A(A>0))

21 hours ago | 2

| accepted

Answered

Unable to convert expression into double array

You are initializing I as double matrix, initialize it as a symbolic matrix syms t; I = zeros(256,256, 'like', t); for i=1:...

Unable to convert expression into double array

You are initializing I as double matrix, initialize it as a symbolic matrix syms t; I = zeros(256,256, 'like', t); for i=1:...

22 hours ago | 0

| accepted

Answered

Sorting columns of a matrix without sort()

See this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/45125-sorting-methods

Sorting columns of a matrix without sort()

See this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/45125-sorting-methods

23 hours ago | 0

| accepted

Answered

plotting two legends on the same plot

It is easier to first create the lines and then make a single call to legend() p = linspace(0,1,50); v = -290*9.8*log(0.15+0.8...

plotting two legends on the same plot

It is easier to first create the lines and then make a single call to legend() p = linspace(0,1,50); v = -290*9.8*log(0.15+0.8...

24 hours ago | 0

| accepted

Answered

Import data doesn't import some of the values

Have you tried readmatrix()? It seems to import the value correctly format long M = readmatrix('weighted_network.txt'); x = M...

Import data doesn't import some of the values

Have you tried readmatrix()? It seems to import the value correctly format long M = readmatrix('weighted_network.txt'); x = M...

1 day ago | 1

| accepted

Answered

Solve a Matrix equation

There might be an algebric way to solve this problem, but following shows an optimization based method rng(0); B = rand(4)+1i*...

Solve a Matrix equation

There might be an algebric way to solve this problem, but following shows an optimization based method rng(0); B = rand(4)+1i*...

1 day ago | 0

Answered

doubt about student license

You can install and activate it on two PC, but you are allowed to use only one of them at a time. Close it on one PC before open...

doubt about student license

You can install and activate it on two PC, but you are allowed to use only one of them at a time. Close it on one PC before open...

1 day ago | 1

Answered

How to find average of certain cells in a column if it's associated with another cells in another column?

You can use splitapply() A = [1, 1 2, 1 3, 2 4, 2 5, 2 6, 3 7, 3]; [grps, vals] = findg...

How to find average of certain cells in a column if it's associated with another cells in another column?

You can use splitapply() A = [1, 1 2, 1 3, 2 4, 2 5, 2 6, 3 7, 3]; [grps, vals] = findg...

1 day ago | 0

Answered

How to assign value in multidimensional variable?

It will only give error if AAA is already defined. Try the following code clear AAA prod = 1; ch = 1;sub = 1; AAA(sub,prod,ch...

How to assign value in multidimensional variable?

It will only give error if AAA is already defined. Try the following code clear AAA prod = 1; ch = 1;sub = 1; AAA(sub,prod,ch...

1 day ago | 0

| accepted

Answered

Automatically insert coefficients in surface fit

You can use fprintf() fprintf('data(x,y) = %.4f + %.4f*x + %.4f*y\n', data.p00, data.p10, data.p01)

Automatically insert coefficients in surface fit

You can use fprintf() fprintf('data(x,y) = %.4f + %.4f*x + %.4f*y\n', data.p00, data.p10, data.p01)

1 day ago | 0

Answered

Using fsolve function with binary non-linear problem

No. ga(): https://www.mathworks.com/help/gads/ga.html from Global optimization toolbox is the only solver that supports nonlinea...

Using fsolve function with binary non-linear problem

No. ga(): https://www.mathworks.com/help/gads/ga.html from Global optimization toolbox is the only solver that supports nonlinea...

1 day ago | 0

| accepted

Answered

How to set initial guess for vpasolve in a system of equations?

See the init_param in vpasolve(). Since you want to specify a bound bound for only a single variable, you can do it like this x...

How to set initial guess for vpasolve in a system of equations?

See the init_param in vpasolve(). Since you want to specify a bound bound for only a single variable, you can do it like this x...

1 day ago | 0

Answered

Undefined function 'ecg' for input arguments of type 'double'.

ecg() is not a MATLAB's built-in function. You need to ask the author of the code to give you this function.

Undefined function 'ecg' for input arguments of type 'double'.

ecg() is not a MATLAB's built-in function. You need to ask the author of the code to give you this function.

1 day ago | 1

| accepted

Answered

Rectangle wave in MATLAB App Designer

First convert the given points in the correct order for drawing a polygon x = [2, 4, 1, 3]; y = [1, 2, 4, 5]; pts = [x(:) y...

Rectangle wave in MATLAB App Designer

First convert the given points in the correct order for drawing a polygon x = [2, 4, 1, 3]; y = [1, 2, 4, 5]; pts = [x(:) y...

1 day ago | 0

Answered

how can i swap the matrix element using control statements or any built in functions?

You can just use sort() with reshape() D = [10 20 50 60;33 55 44 100; 3 6 12 9;4 2 1 3] E = reshape(sort(D(:), 'descend'), siz...

how can i swap the matrix element using control statements or any built in functions?

You can just use sort() with reshape() D = [10 20 50 60;33 55 44 100; 3 6 12 9;4 2 1 3] E = reshape(sort(D(:), 'descend'), siz...

2 days ago | 0

Answered

Average vector of an array

You can specify the dimension in mean() function. For example x = [0 2; 0 2; 0 2; 0 2; 0 2; 0 2];...

Average vector of an array

You can specify the dimension in mean() function. For example x = [0 2; 0 2; 0 2; 0 2; 0 2; 0 2];...

2 days ago | 1

Answered

MacBook Air m1

It is not supported yet. A version based on Rosetta 2 is expected to be released in December. The timeline for native support is...

MacBook Air m1

It is not supported yet. A version based on Rosetta 2 is expected to be released in December. The timeline for native support is...

2 days ago | 0

Answered

how to calculate number of unique element in array?

Try splitapply() c = [ 1 1 1 1 1 1 2 1 2 2 2 3 2 4 ...

how to calculate number of unique element in array?

Try splitapply() c = [ 1 1 1 1 1 1 2 1 2 2 2 3 2 4 ...

2 days ago | 1

| accepted

Answered

How to know if a vector lies inside two vectors

Try this x_low; % lower line in red x_upper; % upper line in red y; % line in blue tf = all((x_low<=y)&(y<=x_high))

How to know if a vector lies inside two vectors

Try this x_low; % lower line in red x_upper; % upper line in red y; % line in blue tf = all((x_low<=y)&(y<=x_high))

2 days ago | 0

| accepted

Answered

Undefined function or variable 'arrayDatastore'.

arraydatastore(): https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.arraydatastore.html was introduced i R2020b. You...

Undefined function or variable 'arrayDatastore'.

arraydatastore(): https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.arraydatastore.html was introduced i R2020b. You...

2 days ago | 0

| accepted

Answered

Reversing the y-axis values without reversing the image.

An easy solution will be just flip the labels. Run the following line yticklabels(flip(yticklabels)) after creating the figure...

Reversing the y-axis values without reversing the image.

An easy solution will be just flip the labels. Run the following line yticklabels(flip(yticklabels)) after creating the figure...

2 days ago | 0

Answered

Remove Duplicates from Cell Array

You can use unique() C; % your cell array country_names = unique(C(:,1))

Remove Duplicates from Cell Array

You can use unique() C; % your cell array country_names = unique(C(:,1))

3 days ago | 0

| accepted

Answered

excluding a small combinations from a combination?

Try this a=[1 2 3 4 5 6 7 8 9 10]; M = nchoosek(a,4); C = mat2cell(string(M), size(M,1), ones(size(M,2),1)); C = regexp(strc...

excluding a small combinations from a combination?

Try this a=[1 2 3 4 5 6 7 8 9 10]; M = nchoosek(a,4); C = mat2cell(string(M), size(M,1), ones(size(M,2),1)); C = regexp(strc...

3 days ago | 0

Answered

how to multiple successive numbers?

You can use prod() prod(70:80)

how to multiple successive numbers?

You can use prod() prod(70:80)

3 days ago | 0

| accepted

Answered

How to select a specific line from text file

If the file have fixed number of header lines, then try this f = fopen('data.txt'); data = textscan(f, '%f', 'HeaderLines', 9)...

How to select a specific line from text file

If the file have fixed number of header lines, then try this f = fopen('data.txt'); data = textscan(f, '%f', 'HeaderLines', 9)...

3 days ago | 0

| accepted

Answered

Undefined function or variable 'ran' in matlab R2018a

The function name is rand(): https://www.mathworks.com/help/matlab/ref/rand.html, not ran().

Undefined function or variable 'ran' in matlab R2018a

The function name is rand(): https://www.mathworks.com/help/matlab/ref/rand.html, not ran().

4 days ago | 0

Answered

SUM of selected elements in Matrix

Are you looking for something like this M = [1 1 2 60; 2 3 2 90; 3 1 3 240; 4 2 3 200; 5 3 3...

SUM of selected elements in Matrix

Are you looking for something like this M = [1 1 2 60; 2 3 2 90; 3 1 3 240; 4 2 3 200; 5 3 3...

4 days ago | 0

| accepted

Answered

How to Reduce precision in symbolic calculations? I am finding y coordinates of a function using the given values of x, but i need a precision of only 6 digits whereas it is showing precision of upto 32 digits. Is there any way to reduce this.

You can use vpa() vpa(Yc, 6)

How to Reduce precision in symbolic calculations? I am finding y coordinates of a function using the given values of x, but i need a precision of only 6 digits whereas it is showing precision of upto 32 digits. Is there any way to reduce this.

You can use vpa() vpa(Yc, 6)

4 days ago | 0

| accepted

Answered

I can't get millisecond accuracy from string based timestamp - not sure what I'm doing wrong

Also set the format property to display them in the format you want formatted_timestamps = datetime(raw_timestamps, 'InputForma...

I can't get millisecond accuracy from string based timestamp - not sure what I'm doing wrong

Also set the format property to display them in the format you want formatted_timestamps = datetime(raw_timestamps, 'InputForma...

4 days ago | 0

| accepted