44,585 total contributions since 2011

I do not do free private consulting. If you want to bring my attention to something, send a link to the MATLAB Answers location.

Answered

I need help using for and if for plotting a function.

e_vals = 0:0.02/1071:0.02; num_e = length(e_vals); s = zeros(1, num_e); for e_idx = 1 : num_e e = e_vals(e_idx); if...

I need help using for and if for plotting a function.

e_vals = 0:0.02/1071:0.02; num_e = length(e_vals); s = zeros(1, num_e); for e_idx = 1 : num_e e = e_vals(e_idx); if...

4 hours ago | 0

Answered

formula representation with matlab.

syms rho L N_r P_b = (1/2 * (1 - sqrt(rho/(2+rho)))^(2*N_r)) * symsum( nchoosek(2*N_r - 1 + L, L) * (1/2 * (1 - sqrt(rho/(2+rho...

formula representation with matlab.

syms rho L N_r P_b = (1/2 * (1 - sqrt(rho/(2+rho)))^(2*N_r)) * symsum( nchoosek(2*N_r - 1 + L, L) * (1/2 * (1 - sqrt(rho/(2+rho...

6 hours ago | 0

Answered

Issue with atan2(.)

>> atan2(0.06) Error using atan2 Not enough input arguments. >> atan2(0,0.06) ans = 0 atan(0.06) ans = 0.05...

Issue with atan2(.)

>> atan2(0.06) Error using atan2 Not enough input arguments. >> atan2(0,0.06) ans = 0 atan(0.06) ans = 0.05...

6 hours ago | 0

| accepted

Answered

Dot indexing error for naming variable

Either variable d or e exists already and is not a structure. d.(k)= uint8(b) .* uint8(b>180); The above line is a problem: k ...

Dot indexing error for naming variable

Either variable d or e exists already and is not a structure. d.(k)= uint8(b) .* uint8(b>180); The above line is a problem: k ...

7 hours ago | 0

Answered

Powermod involving REALLY large integers

Even though you have set digits large enough, s=vpa((n-1)/2^r) always produces a symbolic floating point number because that is ...

Powermod involving REALLY large integers

Even though you have set digits large enough, s=vpa((n-1)/2^r) always produces a symbolic floating point number because that is ...

8 hours ago | 0

| accepted

Answered

Which Dct Algorithm is used ?

https://www.mathworks.com/help/images/ref/dct2.html#d117e44015 describes the Discrete Cosine Transfer dct2 does dct(), transpo...

Which Dct Algorithm is used ?

https://www.mathworks.com/help/images/ref/dct2.html#d117e44015 describes the Discrete Cosine Transfer dct2 does dct(), transpo...

17 hours ago | 0

Answered

Vectors must be the same lengths. how to solve this error

STATISTICS(r+1).AVG=avg; r is not changing inside that loop, so you are always overwriting the same location, and all of th...

Vectors must be the same lengths. how to solve this error

STATISTICS(r+1).AVG=avg; r is not changing inside that loop, so you are always overwriting the same location, and all of th...

17 hours ago | 0

Answered

Conversion to double from function_handle is not possible

errors = zeros (n); That says that errors is to be created as an n by n array of double precision values initialized to all zer...

Conversion to double from function_handle is not possible

errors = zeros (n); That says that errors is to be created as an n by n array of double precision values initialized to all zer...

17 hours ago | 0

Answered

What's the transpose complexity Big O in Matlab?

%what's the Big O complexity here for transposing the "a" 1D array. O(1) -- that is, constant in the size of the array. %what'...

What's the transpose complexity Big O in Matlab?

%what's the Big O complexity here for transposing the "a" 1D array. O(1) -- that is, constant in the size of the array. %what'...

17 hours ago | 0

| accepted

Answered

How can I manage a .csv imported file?

mask = YourSignal(:).' > 0; starts = strfind([false mask], [0 1]); stops = strfind([mask false], [1 0]); Now starts and stops...

How can I manage a .csv imported file?

mask = YourSignal(:).' > 0; starts = strfind([false mask], [0 1]); stops = strfind([mask false], [1 0]); Now starts and stops...

17 hours ago | 0

Answered

Using dir to extract the names of plexon files for upload

cd(currD) dinfo=dir('day1') Don't do that. Instead dinfo = dir(fullfile, currD, 'day1'); dinfo(ismember({dinfo.n...

Using dir to extract the names of plexon files for upload

cd(currD) dinfo=dir('day1') Don't do that. Instead dinfo = dir(fullfile, currD, 'day1'); dinfo(ismember({dinfo.n...

18 hours ago | 0

Answered

Change the number of bins in Radon transform

% Grandfathered syntax % R = RADON(I,THETA,N) returns a Radon transform with the % projection computed at N points. R has ...

Change the number of bins in Radon transform

% Grandfathered syntax % R = RADON(I,THETA,N) returns a Radon transform with the % projection computed at N points. R has ...

18 hours ago | 0

| accepted

Answered

Computing the explicit expression of the integral of a function of two variables inetgrated with respective to only one variable

f = vpa([Tau1;Tau2;Tau3;Tau4;Tau5;Tau6],3) You are using finite precision software floating point numbers. TL1 = (1/2)*int(rho...

Computing the explicit expression of the integral of a function of two variables inetgrated with respective to only one variable

f = vpa([Tau1;Tau2;Tau3;Tau4;Tau5;Tau6],3) You are using finite precision software floating point numbers. TL1 = (1/2)*int(rho...

24 hours ago | 0

Answered

For loops: initialize the sum variable

SUM = SUM + an = (-1/3)^n/(2*n + 1); That is invalid syntax. You cannot have two = in the same statement. end disp(' ') That...

For loops: initialize the sum variable

SUM = SUM + an = (-1/3)^n/(2*n + 1); That is invalid syntax. You cannot have two = in the same statement. end disp(' ') That...

1 day ago | 0

Answered

non linear equation using newtons method

xold is not defined in your function before the first time you use it. However, your use of xo = [x1 x2 ]'; hints that xold is...

non linear equation using newtons method

xold is not defined in your function before the first time you use it. However, your use of xo = [x1 x2 ]'; hints that xold is...

2 days ago | 0

| accepted

Answered

write a function to calculate f(n)=f(1-1)+f(1-2) where f1=(1),f2=(2)

f(1-1) is f(0) and f(1-2) is f(-1) . The sum of the two would be constant, so f(n) would have to be constant. That is inconsiste...

write a function to calculate f(n)=f(1-1)+f(1-2) where f1=(1),f2=(2)

f(1-1) is f(0) and f(1-2) is f(-1) . The sum of the two would be constant, so f(n) would have to be constant. That is inconsiste...

2 days ago | 0

Answered

Generate normally distributed sample from data

You can only do that under the circumstance that the column already contains normally distributed samples. If that is the case t...

Generate normally distributed sample from data

You can only do that under the circumstance that the column already contains normally distributed samples. If that is the case t...

2 days ago | 0

Answered

How to convert dicom image world coordinates into Cartesian coordinates

See https://www.mathworks.com/matlabcentral/answers/215612-how-can-i-convert-pixels-to-mm-for-a-specific-dicom-image#answer_178...

How to convert dicom image world coordinates into Cartesian coordinates

See https://www.mathworks.com/matlabcentral/answers/215612-how-can-i-convert-pixels-to-mm-for-a-specific-dicom-image#answer_178...

2 days ago | 0

Answered

Loop problem...please help

Take a copy of the input. Go through it starting from the end. If the current entry is the same as the entry before it in the ar...

Loop problem...please help

Take a copy of the input. Go through it starting from the end. If the current entry is the same as the entry before it in the ar...

2 days ago | 0

| accepted

Answered

Empty 0-by-1 when using solve:

The equations are inconsistent. If you solve the first 7 equations for [x1, x2, x3, x4, x5, x7, x8], and substitute those in to ...

Empty 0-by-1 when using solve:

The equations are inconsistent. If you solve the first 7 equations for [x1, x2, x3, x4, x5, x7, x8], and substitute those in to ...

2 days ago | 0

Answered

Call function multiple times but execute once

https://www.mathworks.com/help/matlab/ref/memoize.html

Call function multiple times but execute once

https://www.mathworks.com/help/matlab/ref/memoize.html

2 days ago | 1

| accepted

Answered

plot loop in a legend

plot(Temperatura(:,Dmod(n)),Quota,'-', 'DisplayName', ID{nvar}) hold on plot(Tmis(:,Dmis(n...

plot loop in a legend

plot(Temperatura(:,Dmod(n)),Quota,'-', 'DisplayName', ID{nvar}) hold on plot(Tmis(:,Dmis(n...

2 days ago | 1

| accepted

Answered

Multiple function handle in varfun

You can use @(v) [mean(v), std(v)] as the function, and splitvars() afterwards.

Multiple function handle in varfun

You can use @(v) [mean(v), std(v)] as the function, and splitvars() afterwards.

2 days ago | 0

Answered

How do I use the pcode to regenerate?

You would need the source code r2t.m You appear to be using https://www.rmr.tu-darmstadt.de/lehre_rmr/elearning_rmr/rt2_mat...

How do I use the pcode to regenerate?

You would need the source code r2t.m You appear to be using https://www.rmr.tu-darmstadt.de/lehre_rmr/elearning_rmr/rt2_mat...

2 days ago | 0

Answered

How to turn a camera webcam into a video.

camera = VideoReader('slow.avi') nnet = alexnet; % Load the neural net pic = image([]); while hasFrame(camera) pict...

How to turn a camera webcam into a video.

camera = VideoReader('slow.avi') nnet = alexnet; % Load the neural net pic = image([]); while hasFrame(camera) pict...

3 days ago | 1

| accepted

Answered

How to create a circle within a matrix

x=-.10:.002:.10; %note change from 0.02 to 0.002 [X,Y]=meshgrid(x); % xy space v1=zeros(size(X)); % previo...

How to create a circle within a matrix

x=-.10:.002:.10; %note change from 0.02 to 0.002 [X,Y]=meshgrid(x); % xy space v1=zeros(size(X)); % previo...

3 days ago | 1

| accepted

Answered

how save results?

save() permits using a wildcard, such as save('filename.mat', 'z_room*') save() also permits a -regexp option for more complic...

how save results?

save() permits using a wildcard, such as save('filename.mat', 'z_room*') save() also permits a -regexp option for more complic...

3 days ago | 0

| accepted

Answered

How do i set axis to only positive numbers for polyfit function

ylim([0 60])

How do i set axis to only positive numbers for polyfit function

ylim([0 60])

3 days ago | 0

Answered

Function: Compare each Element of 2 Matrix for zero and non-zero

Z2 = Z^2; output = all(all(~Z2 | Z));

Function: Compare each Element of 2 Matrix for zero and non-zero

Z2 = Z^2; output = all(all(~Z2 | Z));

3 days ago | 0