https://nl.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2021-01-24T06:52:13Ztag:nl.mathworks.com,2005:Question/7253722021-01-24T06:52:13Z2021-01-24T06:52:13ZCan i do Wavelet coherence in MATLAB R2014a ?I'm using MATLAB R2014a and couldn't able to use the function ' wcoherence'. When I run the program it shows:
Undefined function 'wcoherence' for input arguments of type 'double'.
When I used the old function 'wcoher' it works. What should I do to use 'wcoherence' in R2014a?sakt hidhttps://nl.mathworks.com/matlabcentral/profile/authors/21181001tag:nl.mathworks.com,2005:Question/7251722021-01-23T19:45:18Z2021-01-24T06:50:30ZPlotting a smooth curve from points I'm trying to plot a smooth line for 6 points in such a way that slope at each is zero. I have successfully achieved it for middle points using 'pchip' but I also want it for extreme points i.e. x=0 and x=15 which I am unable to do while using 'pchip'.
Here is my code
clear
clc
x = [0;3;6;9;12;15];
y = [0;1.9190;-3.2287;3.5133;-2.6825;1];
xi = linspace(min(x), max(x), 150); % Evenly-Spaced Interpolation Vector
yi = interp1(x, y, xi, 'pchip');
figure
plot(x, y, 'b')
hold on
plot(xi, yi, '-r')
hold off
grid
xlabel('X')
ylabel('Y')
legend('Original Data', 'Interpolation', 'Location', 'NE')
Osama Anwarhttps://nl.mathworks.com/matlabcentral/profile/authors/20535048tag:nl.mathworks.com,2005:Question/7166882021-01-14T09:02:58Z2021-01-24T06:46:08Zhow can i load into MATLAB specific pixels of a .tiff file?I need to load into MATLAB a lot of .tiff files (a few thousands), and to speed the process I wanted to read only the interesting pixels (or index) from any file.
is there a way to do it without loading the full files?Orel Levyhttps://nl.mathworks.com/matlabcentral/profile/authors/20679606tag:nl.mathworks.com,2005:Question/7227732021-01-21T06:45:56Z2021-01-24T06:42:55ZHow to fit a dress on human body automatically ?How to fit a dress on human body automatically ? Selva Karnahttps://nl.mathworks.com/matlabcentral/profile/authors/4733665tag:nl.mathworks.com,2005:Question/7252372021-01-23T22:53:25Z2021-01-24T06:42:25Zdynamically save a matrix to a structure I have a loop that evaluates a matrix X for each scenario. The size of this matrix X changes at each iteration, and the values too. I would like to make a structure X.1, X.2 etc to X.(n), and save the result X. When I do eval(['[Z.SET'num2str(J) ']= (Xtmp);']); X.1 gets overwritten by X.2, what I mean is that at first I have X.1 with the desired X matrix, but at the next loop, X.1 is no longer there and there is X.2 (with the corresponding X matrix). How can I “save” the X.1 so that it doesn’t get overwritten?Ahttps://nl.mathworks.com/matlabcentral/profile/authors/12970920tag:nl.mathworks.com,2005:Question/7252722021-01-24T00:23:04Z2021-01-24T06:41:48ZIn an assignment A(I) = B, the number of elements in B and I must be the sameHi, I need help.
What should i do for fix this error
function dydt = fix_reaksi_tumor_glioma(t,y)
dydt = zeros(size(y));
% Parameter model pertumbuhan glioma (1 g/ml = 10^3 mg/ml)
aT = 1.575; % ml^2 g^-2 day^-1
KT = 2; % g/ml
dTI = 0.072; % day^-1
aTI = 3*10^-4; % day^-1
dT = 1*10^-4; % day^-1
dI = 0.01; % day^-1
as = 0.7; % day^-1
v = 0.7; % day^-1
dTo = 1; % day^-1
ao = 20; % day^-1
omin = 8.00*10^-4; % g/ml
o0 = 1.6*10^-3; % g/ml
do1 = 0.01; % day^-1
do2 = 0.00625; % day^-1
dTT = 0.72; % day^-1
f_glukosa = omin*sin(6*pi*t); %Asupan glukosa
T = y(1); % pertumbuhan sel glioma (Tumor)
B = y(2); % konsetrasi glukosa dalam otak (obrain)
I = y(3); % aktivitas sistem kekebalan tubuh (imune)
S = y(4); % konsentrasi glukosa dalam serum (oserum)
dydt(1)= aT*B*T*(1-T/KT) - dT*T - dTI*T*I;
dydt(2)= ao*(S-B) - dTo*T*B - (do1+as*(v+I))*B;
dydt(3)= as*(v+I)*B + aTI*T*I - dI*I - dTT*T*I;
dydt(4)= ao*(B-S) + f_glukosa - do2*S;
dydt=[dydt(1); dydt(2); dydt(3); dydt(4)];
I get error
Error in fix_reaksi_tumor_glioma (line 33)
dydt(4)= ao*(B-S) + f_glukosa - do2*S;
K>> dydt(4)= ao*(B-S) + f_glukosa - do2*S;
In an assignment A(I) = B, the number of elements in B and I
must be the same.Lutfi Adamhttps://nl.mathworks.com/matlabcentral/profile/authors/21192163tag:nl.mathworks.com,2005:Question/7185252021-01-16T11:25:26Z2021-01-24T06:38:44ZUse of Matlab's OCR to recognize Math EquationI'm trying to use Matlab's ocr to recognize math equations but the result was some unknown characters.
This is my input:
and the output was:
How can I improve or solve this problem? I just followed the code on the ocr documentaions and use the 'MathEquation' Language
here is the code:
x = imread('1.png');
results = ocr(x,'Language', 'MathEquation')
recognized = results.Text;
figure;
imshow(x);
text(600,150, recognized,'BackgroundColor', [1 1 1]);Wifraim Neil San Miguelhttps://nl.mathworks.com/matlabcentral/profile/authors/16181980tag:nl.mathworks.com,2005:Question/7237682021-01-22T07:38:18Z2021-01-24T06:37:36ZHow to extract image roi [non scale roi] and how to assign another image roi location ?[ non-scale roi area ?How to extract image roi [non scale roi from dora image] and how to assign another image roi location ?[ non-scale roi area --to the bag]
Both images are different rows and columns ?
?
Expect like below image:
Selva Karnahttps://nl.mathworks.com/matlabcentral/profile/authors/4733665tag:nl.mathworks.com,2005:Question/4218712018-10-02T19:33:48Z2021-01-24T06:36:34Znew version of "newtr" functionHi everybody
I got a code (SRGTSToolbox) that has been written with old version of MATLAB. This is a part of that code:
% CALCULATE ACTUAL ERROR
w1 = p(:,used)';
a1 = radbas(dist(w1,p)*b);
[w2,b2] = solvelin2(a1,t);
a2 = w2*a1 + b2*ones(1,q);
sse = sumsqr(t-a2);
% Start
tr = newtr(mn,'perf');
tr.perf(1) = sumsqr(t);
tr.perf(2) = sse;
As can be seen there is a function called "newtr". What's the updated version of this function in MATLAB 2015? This is a part of radial basis neural network code.
Thanks
Andrea Vanghttps://nl.mathworks.com/matlabcentral/profile/authors/13207709tag:nl.mathworks.com,2005:Question/7210842021-01-19T12:06:54Z2021-01-24T06:35:21ZHow to formulate elegantly and performant functions that depend on a lot of input variablesHello,
I am not new to MATLAB. However, I have the following problem:
If I have a function e.g.:
output = f(in1,in2,in3,in4,in5,in6,...)
which depends on a lot of input variables.
How can I design it as elegant as possible but at the same time performant?
If I use a strcut e.g.
input.in1
input.in2
input.in3
...
I can formulate the function nice and short:
output = f(input)
But the problem is that the variable naming is fixed for the input as well as in the function. Furthermore, calling values from a struct is slow, so in the function they have to be read first:
function [output] = f(input)
in1 = input.in1
in2 = input.in2
in3 = input.in3
...
% calculations with in1,in2,in3,...
end
I also know that you should not write a function with so many input variables, yet it happens.
How do you handle such cases? Ferdinand Breithttps://nl.mathworks.com/matlabcentral/profile/authors/9184835tag:nl.mathworks.com,2005:Question/2165632015-05-13T15:26:02Z2021-01-24T06:31:43ZHow to write fast fourier transform function without using fft function ? function [A]=DFT(x)
N=length(x);
for k=1:N
A(k)=0;
for n=1:N
A(k)=A(k)+x(n).*exp((-1j).*2.*pi.*(n-1).*(k-1)./N);
end
end
Nur Kaynarhttps://nl.mathworks.com/matlabcentral/profile/authors/6505303tag:nl.mathworks.com,2005:Question/7251272021-01-23T18:19:39Z2021-01-24T06:29:26ZNot enough input arguments.Hi, i am having issue to run a VAR model were the following error is flagged:
>> VARmodel
Not enough input arguments.
Error in VARmodel (line 33)
[nobs, nvar] = size(ENDO);
Should I have to quote nobs and nvar?economics studenthttps://nl.mathworks.com/matlabcentral/profile/authors/7041546tag:nl.mathworks.com,2005:Question/7253672021-01-24T06:28:23Z2021-01-24T06:28:23ZFastest way to find text keywords out of large amount of textual news sentences?Hello, I have a database containing over 900,000 line of news. And I want to scan these lines of texts for certain keyword. I tried
tic; strfind(newsDb.SingleNewline, kws{1}); toc
tic; contains(newsDb.SingleNewline, kws{1}); toc
both takes over 0.003 sec for search in one keyword in one news line.
If I want to create a new database with over 20,000 keywords, then it would take
900000 * 20000 * 0.003 / 60 / 60 / 24
over 600 days to do this. :(
Anyone has perhaps an idea how to to this within perhaps one-two day?
Thank you very much
Song Decnhttps://nl.mathworks.com/matlabcentral/profile/authors/10395652tag:nl.mathworks.com,2005:Question/2804142016-04-22T12:53:38Z2021-01-24T06:27:02ZLaTeX in Live Scripts - Using \matrixI want to use the new Live Scripts feature to include a matrix.
The usual way of doing this:
\begin{pmatrix} A & B \\ C & D \end{pmatrix}
doesn't work.
The documentation says to use the \matrix command. This works for a row vector:
\pmatrix{a & b}
but not for a column vector or full matrix, i.e.
\matrix{a & b \\ c & d}
How would I render a full matrix in the equation editor within live scripts?
Alexanderhttps://nl.mathworks.com/matlabcentral/profile/authors/4188542tag:nl.mathworks.com,2005:Question/4615672019-05-12T02:26:31Z2021-01-24T06:26:20ZFit Data to a Polar EquationThis is a little abstract, but I have data that is represented of some form of polar equation, and I would like to fit a polar equation to this data as accurately as possible. I don't want to fit it to a circle nor do I want to fit it to an ellipse. I want to fit it to a general polar function. Basically, what I am thinking of, is an analog of a polyfit of a high number to very accurately fit a cartesian function in polar coordinates. Just wondering if something like this exists in matlab. John Shackletonhttps://nl.mathworks.com/matlabcentral/profile/authors/14657992tag:nl.mathworks.com,2005:Question/7249272021-01-23T13:31:33Z2021-01-24T06:23:20ZUnknown File/Folder in directoryHI, I'm one of the enw users of Matlab.
I'm Having some problem in folder and sub folder reading......
Look at this Code....
Name = '.\train20X20\'
Main_File = dir(fullfile(Name));
Normal access to a folder, but this folder has 34 sub folder in it but when I compile this line, on the (Workspace) Tab the variable Main_File shows that there are 36 folders in it.
What does this mean, I dont Understand.
In the Main folder there are 34 subfolders having 10 images each. what is wrong.
after that when i try to make a loop to access the subfolder using there names it shows an error message.
I tried bothg with Curly Brackets and Small Brackets but the same message appeared.
Few Monthes Earliar i worked on something similar, the function worked perfectly but this time it's not working i dont know what wrong.
Mir AbdulRehmanhttps://nl.mathworks.com/matlabcentral/profile/authors/17939352tag:nl.mathworks.com,2005:Question/7253522021-01-24T04:37:28Z2021-01-24T06:15:02Zread the first 3 lines of a file and extract variables without reading the restHello,
I have a file "toread.txt" have following lines,
Profile=" time= 0.123456 "
VARIABLES = "X" "Y" "Z"
Z="XY" X= 10,Y= 10,
0.00000 0.00000 0.00000E+00
0.01953 0.00000 0.00000E+00
How could I read and extract the first three variables, t = 0.123456, X = 10, and Y = 10, without reading the rest of the document?
Thanks! Lei Zenghttps://nl.mathworks.com/matlabcentral/profile/authors/16066587tag:nl.mathworks.com,2005:Question/2226572015-06-05T16:19:43Z2021-01-24T06:04:43ZHow to control for continuous covariates in multiple regressionIf I have two predictor variables, say x1 x2, and would like to see what the effect of x1 is on the dependent variable y, how can I remove the effect of x2?
Also how can I visualise this in plot?
Thanks in advance
Dhttps://nl.mathworks.com/matlabcentral/profile/authors/4642374tag:nl.mathworks.com,2005:Question/3432092017-06-03T19:46:41Z2021-01-24T06:00:42ZFind distance between nodesHi i have a dataset of 1853 rows and 2 columns, sample of dataset is as follows:
1 105
1 104
2 1100
10 1165
813 1320
15 105
19 90
105 813
i want to create a graph to find distance between each node from other. For example if i enter input node 1, it will show that distance between 1 and 105 is 1, and between 1 and 813 is 2 (because it will come next to 105). and between 1 and 1320 is 3. (as shown in image below). and similarly for other nodes.
<</matlabcentral/answers/uploaded_files/79512/New%20Bitmap%20Image.bmp>>
Any help will be greatly appreciated. Tha saliemhttps://nl.mathworks.com/matlabcentral/profile/authors/9961300tag:nl.mathworks.com,2005:Question/6507782020-11-17T13:02:23Z2021-01-24T05:33:10ZGenerate random number from custom PDF and CDFI basically have the following CDF and PDF respectivley:
Where the range is from 0 to as mentioned in the CDF line. I would like to generate random numbers on matlab based on these equations. Has anyone done this before? Anyone has experience on this? I've tried looking on the forum but
Thanks in advance!!
(For those of you interested, it is the distribution of a 1-D Random Waypoint Mobility model proposed by Bettstetter et al.)Ismael Ouasshttps://nl.mathworks.com/matlabcentral/profile/authors/13735838tag:nl.mathworks.com,2005:Question/7252772021-01-24T00:57:53Z2021-01-24T04:39:30ZFast code to open and write separate 366 .bin files for each (row,col)I am trying to speed up my code. I have a 18000*36000*366 matrix. I split the matrix into 18 bands of each 1000* 36000 .bin files located in 366 folders. I plan to run the same code for 18 times. The problem is it takes 3.5hrs to process 1*36000 like I wanted. It is super slow, any help is appreciated. Below is my code,
for lat = 1:length(lat_band) % length of lat_band = 1000
for lon = 1:36000
if (mask(lat,lon)~=9) % if ocean then skip
data_1km = data; % matrix of size [366,1];
else
data_1km = NaN(366,1);
end
tmp = 'path';
tic
for day = 1:366
fwrite(fopen(sprintf('%s%d', tmp, day, '/band_1.bin'), 'a'), data_1km(day),'double');
end
fclose('all');
clear data_1km day
toc
end
end
nlmhttps://nl.mathworks.com/matlabcentral/profile/authors/2744890tag:nl.mathworks.com,2005:Question/7251772021-01-23T19:53:43Z2021-01-24T04:15:31ZExcluding folders from a dir StructureI was wondering about excluding folders from a dir struct that contain the words 'output'
I understand how to exclude the first couple of entries in the struct
d = dir(pathName);
d = d(~ismember({d.name},{'.','..'}));
but is there a way that I could maybe use regexpi() inorder to find folders that contain the key world then insert them into the second line above?Boris Kabistanhttps://nl.mathworks.com/matlabcentral/profile/authors/11423895tag:nl.mathworks.com,2005:Question/7236482021-01-22T02:44:05Z2021-01-24T04:07:36ZHello everyone. I have a long-standing problem, how to calculate the similarity between the two curves that have been fitted. Thank you for your enthusiastic answers.corrcoef(f1,f2)
corr2(f1,f2)Wesleyhttps://nl.mathworks.com/matlabcentral/profile/authors/19428999tag:nl.mathworks.com,2005:Question/7250372021-01-23T16:47:45Z2021-01-24T04:04:19Zhow to convert dicom image to pngHi all,
i want to convert my dicom image to png image.
below my coding, but error. Anyone can help me?
[I, map]=dicomread('lung.dcm');
imwrite(I,map,'lung.png','png');
ERRORR!!!!
Error using imwrite>parse_inputs (line 628)
The colormap should have three columns.
Error in imwrite (line 440)
[data, map, filename, format, paramPairs] = parse_inputs(varargin{:});
CAN HELP ME?mohd akmal masudhttps://nl.mathworks.com/matlabcentral/profile/authors/10957567tag:nl.mathworks.com,2005:Question/7253422021-01-24T03:48:53Z2021-01-24T03:57:15ZWGAN-GP loss function How to use the wgan-gp loss function？ is it implemenetd in Matlab2020b?daokun leehttps://nl.mathworks.com/matlabcentral/profile/authors/8508239tag:nl.mathworks.com,2005:Question/7253472021-01-24T03:54:19Z2021-01-24T03:54:19ZHow `gpuArray` save sparse matrix when running Preconditioned conjugated gradient?Hi, I am using cuda in Matlab to accelerate the Preconditioned conjugated gradient evaluation of "Ax = b". I'm glad to find the pcg without any preconditioner on GPU run faster (x6~7) than ichol preconditioned pcg on CPU. I would like to know how gpuArray allocate the sparse matrix on GPU, in CSR, ELL or any other format. I heard that the different storage format influences the evaluation speed. So I would like to compare these formats on my matrix to optimal my code. I found no option of these formats' setting in the function of gpuArray. I uncertainly speculate gpuArray may allocate the sparse matrix dynamically. Could you give some suggestion or document link of this problem?
Thank you.wei zhanghttps://nl.mathworks.com/matlabcentral/profile/authors/3994770tag:nl.mathworks.com,2005:Question/7253072021-01-24T02:19:05Z2021-01-24T03:53:07Zintegral2 error message Error using integral2 (line 71) XMIN must be a floating point scalar.
Create the anonymous function.
fun = @(x,y) 4+(y./25)-(x.^2)./50;
Integrate and to q1, Integrate and to q2
q1 = integral2(fun,-1,1,-1,0)
xmin = @(y) -sqrt(1-y.^2);
xmax = @(y) sqrt(1-y.^2);
q2 = integral2(fun,xmin,xmax,0,1)
Error using integral2 (line 71)
XMIN must be a floating point scalar.
final =q1+q2
anyone can help in this error?Guan We Tanhttps://nl.mathworks.com/matlabcentral/profile/authors/21189901tag:nl.mathworks.com,2005:Question/7253372021-01-24T03:42:36Z2021-01-24T03:46:48Z4-PSK modulation code issueI have a project where I have to modify a code to work as a 4-PSK modulation. The part in the function where I have to calculate the correlation is confusing me and I am not sure how am I supoosed to compare 5 correlation matrices in the function code.
Edit: I figured that I will use dot function to achieve the correlation matrix but I am still confused about why do I have to use or how am I supposed the 5th correlation matrix or to even calculate it. If it is 4 then it is easy to do but 5 doesn't make sense to me.
The picture has the steps of the project;
and I have been given a code where I have to modify it from Binary PAM to 4-PSK or 4-Ary Phase Modulation
%Binary PAM
N = 100; % packet length each packet contains 100 bits
N_0 = 1; % noise variance is set to 1
no_of_packets = 1000; % we simulate 1000 packets, where each packet contains N_bits
Max_Eb = 8; %in dB units i.e. 10 log (Eb/N_0) where N_0=1
bit_error_rate = zeros(1 ,Max_Eb); %simulated bit error probabilities are stored in this vector
for i =1:Max_Eb
Eb(i) = 10^(i /10); %for 1-Max_Eb range increment Eb in 1 dB steps
end
for i =1:Max_Eb %make simulation for Eb values in 1 dB increments
total_error_count = 0; %total error count for each Eb
for j =1: no_of_packets
error_count = Mod_Demod(N,Eb(i),N_0); %error count for each packet
total_error_count = total_error_count + error_count; %increment the total error count
end
bit_error_rate(i) = total_error_count/(N * no_of_packets); %calculate the bit error rate
end
clf; %clear existing figure
semilogy(10*log10(Eb), bit_error_rate, 'r*'); %plot bit error rate vs Eb/N_o in semilog scale
grid on;
ylabel ('Bit Error Probability');
xlabel ('Eb/N_o in dB');
hold on;
semilogy (10*log10(Eb),qfunc( sqrt(2*Eb/N_0))) ; %plot the the or ethical value of error probability of binary PAM
legend('simulation','theory');
%%=========================================================
% Mod_Demod Function
function [error_count] = Mod_Demod(N,E_b,N_0)
error_count = 0; % set error count to zero
s = zeros (N,1); % transmitted signal vector
n = zeros (N,1); % noise vector
r = zeros (N,1); % received signal vector
C = zeros (N,2); % correlation metric
x =round(rand(N,1)); % randomly generated binary data vector
x_hat = zeros(N,1); % decoded binary data
for i =1:N
if x(i) == 0
s(i) = sqrt(E_b); % map 0 -> to s1 = sqrt(E_b)
else
s(i) = -sqrt(E_b); % map 1 -> to s2 = -sqrt(E_b )
end
end
n=sqrt (N_0/2)*randn(N,1) ; %generate gaussian noise with variance N_0/2
r = s + n ; %generate the received vector r = s + n
C(1:N,1) = r * sqrt(E_b); %% C(r,s1) , correlation of r with s1
C(1:N,2) = r * -sqrt(E_b); %% C(r,s1) , correlation of r with s2
for i =1:N
if C(i,1) > C(i,2) % decide on s1 if C(r,s1) > C(r,s2)
x_hat(i) = 0;
else %% decide on s2 if C(r,s1) < C(r,s2)
x_hat(i) = 1;
end
end
for i =1:N
if x(i) ~= x_hat(i) %compare original binary data with deduced binary data and find bit errors
error_count = error_count + 1;
end
end
end
what is confusing me about this is the function, I have already modified my function for S to have 4 binary numbers,
function [error_count] = Mod_Demod_two(N,E_b,N_0)
error_count = 0; % set error count to zero
s = zeros(N/2,2); % transmitted signal vector
n = zeros(N,2); % noise vector
r = zeros(N,2); % received signal vector
C = zeros(N,5); % correlation metric
x =round(rand(N,2)); % randomly generated binary data vector
x_hat = zeros(N,2); % decoded binary data
for i = 1:N/2
if x(i,1)==0 && x(i,2)==0
s(i,1) = sqrt(E_b);
s(i,2) = 0;
elseif x(i,1)==0 && x(i,2)==1
s(i,1) = 0;
s(i,2) = sqrt(E_b);
elseif x(i,1)==1 && x(i,2)==0
s(i,1) = -sqrt(E_b);
s(i,2) = 0;
else
s(i,1) = 0;
s(i,2) = -sqrt(E_b);
end
end
%================================ This is where I have modified so far================
n=sqrt(N_0/2)*randn(N/2,2); %generate gaussian noise with variance N_0/2
r = s + n; %generate the received vector r = s + n
C(1:5,2) = r * sqrt(E_b); %% C(r,s1) , correlation of r with s1
C(1:5,2) = r * -sqrt(E_b); %% C(r,s1) , correlation of r with s2
for i =1:N
if C(i,1) > C(i,2) % decide on s1 if C(r,s1) > C(r,s2)
x_hat(i) = 0;
else %% decide on s2 if C(r,s1) < C(r,s2)
x_hat(i) = 1;
end
end
for i =1:N
if x(i) ~= x_hat(i) %compare original binary data with dedoced binary data and find bit errors
error_count = error_count + 1;
end
end
end
The part that is confusing me is the correlation part. I have to compare 5 different correlation matrices to find which one is bigger but I found a code where it compares only 4 and I have no idea what's the point of the 5th correlation matrix
This is the part where I am confused about;
n=sqrt(N_0/2)*randn(N/2,2); %generate gaussian noise with variance N_0/2
r = s + n; %generate the received vector r = s + n
C(1:5,2) = r * sqrt(E_b); %% C(r,s1) , correlation of r with s1
C(1:5,2) = r * -sqrt(E_b); %% C(r,s1) , correlation of r with s2
for i =1:N
if C(i,1) > C(i,2) % decide on s1 if C(r,s1) > C(r,s2)
x_hat(i) = 0;
else %% decide on s2 if C(r,s1) < C(r,s2)
x_hat(i) = 1;
end
end
The code that I found compares 4 correlation or does the decision for C matrices
function[pb,ps]=cm_sm32(snr_in_dB)
N=10000;
E=1;
snr=10^(snr_in_dB/10);
sgma=sqrt(E/snr)/2;
s00=[1 0];
s01=[0 1];
s11=[-1 0];
s10=[0 -1];
for i=1:N,
temp=rand;
if(temp<0.25),
dsource1(i)=0;
dsource2(i)=0;
elseif(temp<0.5),
dsource1(i)=0;
dsource2(i)=1;
elseif(temp<0.75),
dsource1(i)=1;
dsource2(i)=0;
else
dsource1(i)=1;
dsource2(i)=1;
end;
end;
numofsymbolerror=0;
numofbiterror=0;
%===================================From Here this is what I want to implement================
for i=1:N,
n(1)=gngauss(sgma);
n(2)=gngauss(sgma);
if((dsource1(i)==0) & (dsource2(i)==0)),
r=s00+n;
elseif((dsource1(i)==0) & (dsource2(i)==1)),
r=s01+n;
elseif((dsource1(i)==1) & (dsource2(i)==0)),
r=s10+n;
else
r=s11+n;
end;
c00=dot(r , s00);
c01=dot(r , s01);
c10=dot(r , s10);
c11=dot(r , s11);
c_max=max([c00 c01 c10 c11]);
if(c00==c_max)
decis1=0;decis2=0;
elseif(c01==c_max)
decis1=0;decis2=1;
elseif(c10==c_max)
decis1=1;decis2=0;
else
decis1=1;decis2=1;
end;
symbolerror=0;
if(decis1~=dsource1(i)),
numofbiterror=numofbiterror+1;
symbolerror=1;
end;
if(decis2~=dsource2(i)),
numofbiterror=numofbiterror+1;
symbolerror=1;
end;
if(symbolerror==1),
numofsymbolerror=numofsymbolerror+1;
end;
end;
ps=numofsymbolerror/N;
pb=numofbiterror/(2*N);Khalid Sherifhttps://nl.mathworks.com/matlabcentral/profile/authors/13786792tag:nl.mathworks.com,2005:Question/3388222017-05-05T04:55:30Z2021-01-24T03:33:53Zrename files using matlabHello all,
I have a folder on my desktop that has 10 text files as following:
A.txt
Abgd.txt
B.txt
Bbgd.txt
C.txt
Cbgd.txt
S.txt
Sbgd.txt
std.txt
stdbgd.txt
I want to write a code that the changes the names of the first 8 files. I want to rename these files and add an underline (i.e. '_') after the first letterof each file. So my output should look like this:
A_.txt
A_bgd.txt
B_.txt
B_bgd.txt
C_.txt
C_bgd.txt
S_.txt
S_bgd.txt
Here is what I have done so far:
clear all; clc;
d = 'C:\Users\krraz\Desktop\Day13\*.txt';
oldnames = dir(d);
oldnames = {oldnames(~[oldnames.isdir]).name};
L = length(oldnames);
oldnames = oldnames(1:L-2);
points = oldnames(1:2:end);
points = cellfun(@(x) x(1:1), points, 'UniformOutput', false);
strr = '_.txt'; strr = string(strr);
for n = 1:numel(points)
formatSpec = '%1$s%2$s';
points{n} = sprintf(formatSpec,points{n},strr);
end
bgds = oldnames(2:2:end);
bgds = cellfun(@(x) x(1:1), bgds, 'UniformOutput', false);
strr = '_bgd.txt'; strr = string(strr);
for n = 1:numel(bgds)
formatSpec = '%1$s%2$s';
bgds{n} = sprintf(formatSpec,bgds{n},strr);
end
newnames = [points bgds];
newnames = sort(newnames);
for j=1:numel(oldnames)
movefile(d,newnames{j},'f');
end
But when I run my code, It generates a new folder on my desktop and doesn't change the names of the files. What am I doing wrong?
Any insight will be appreciated. Changoleonhttps://nl.mathworks.com/matlabcentral/profile/authors/8600638tag:nl.mathworks.com,2005:Question/7253222021-01-24T02:43:49Z2021-01-24T03:24:42ZMatrix dimensions must agree.t = [0:0.1:10]
L1 = linspace(4,5,101)
L2 = linspace(6,7,101)
ft1 = 1 - 2*t.^2
ft2 = 3*t - 2*t.^3
t1 = (L1.*y-diff(diff(ft1)))/(2*diff(ft1))
t2 = (L2.*y-diff(diff(ft2)))/(2*diff(ft2))
I dont understand what Im doing wrong here. t, L1, L2, ft1 and ft2 are all 1x101 doubles but i keep getting back matrix dimentions must agree. Im sure the problem has something to do with the fact that im using vectors and the MatLab wants matracies, but im not sure. If anyone knows what im donig wrong to get please let me know. Thank you!Joshua Willehttps://nl.mathworks.com/matlabcentral/profile/authors/20775666tag:nl.mathworks.com,2005:Question/7253322021-01-24T03:22:49Z2021-01-24T03:22:49Zhow to plot the motor chamber pressure and the vacuum thrust as a function of both time and web assuming quasi-steady state (equilibrium)I have computed the equilibrium pressure assuming a quasi steady state condition: using the following eq attached to this question and below is my code. How do I plot Pc_eq as a function of time?
clear all
%% Step 1
% ========================================================================= %
% Basing on the motor and propellant data indicated in Table 1 and on the
% burning surface evolution shown in Figs. 5 and 6 and assuming a constant
% chambre temperature profile compute the following curves without taking
% into account the non-ideal parameters.
%% Step 1.1
%Find: The motor chamber pressure and the vaccume thrust as a
% function of both time and web assuming quasi-steady state (equilibrium)
% User inputs - First stage P80 SRM
% ========================================================================= %
mp = 88000; % Propellant Mass [kg]
ms = 7330; % Structural mass [kg]
l = 10.6; % length [m]
d = 3.0; % Diameter [m]
f = 3015; % Max thrust(vaccum) [kN]
bt = 110; % Buring time [sec]
isp = 280; % Specifi Impulse (vaccuum) [sec]
% User inputs - Propellant Ballistic Properties
% ========================================================================= %
a = 1.847e-05; % Temperature coefficient @ 300 K [m/s * Pae-0.4]
n = 0.4; % Combustion index
tau = 0.0015; % Temperature sensitivity [k^-1]
rho = 1790; % Density [kg/m^3]
% User inputs - Propellant thermochemocal properties
% ========================================================================= %
T_F = 3550; % Flame temperature [K]
M = 29; % Molecular mass [kg/kmole]
gamma = 1.13; % Specific heat ratio
% User inputs - Motor geometrical properties
% ========================================================================= %
d_throat = 0.496; % Throat diameter [m]
e = 16; % expansion ratio
v_c = 8.6; % Initial chamber volume [m^3]
v_frac = 0.85; % volumetric loading fraction (V_c/(V_c+V_p)
% constants
% ========================================================================= %
r = 8314.5 % gas constant [J/kmol)
% Calculations
% Find: The motor chamber pressure and the vaccum thrust as a
% ========================================================================= %
a_t = pi* (d_throat/2)^2; % Thrat area [m^2]
m_dot = mp/bt; % mass flow rate [kg/s]
s_b = 48; % burning surface area - pulled from the Sb vs Y plot [m^2]
cap_gamma = sqrt (gamma * (2/(gamma + 1))^((gamma+1)/(gamma-1))); % capital gamma
c_star = (1/cap_gamma)*sqrt((r*T_F)/M);
K = s_b/a_t; % Klemmung
Pc_eq = (a *rho*c_star*K)^(1/(1-n));
Christina Reidhttps://nl.mathworks.com/matlabcentral/profile/authors/16668139tag:nl.mathworks.com,2005:Question/7246832021-01-23T02:52:53Z2021-01-24T03:19:52ZFast Fourier Transform Zero PaddingHi all,
I am using the code shown below to plot the FFT of some data. My issue is that the "resolution" seems poor, as the x axis is in increments of 0.2. I would like much finer plotting of points, and have recently seen the Zero Padding method. However, everytime I try to implement other solutions on MATLAB answers, I cannot seem to increase the resolution. Could anyone help me with the necessary code for my specific case?
O2_exp = [0.0247
0.2372
1.9171
1.5570
0.8016
0.5572
1.2185
1.3601
1.0067
0.7767
1.0244
1.1619
1.0210
0.8791
0.9595
1.0592
1.0274
0.9507
0.9735
1.0303
1.0286
0.9912
0.9924
1.0137
1.0143
0.9982
0.9996
1.0097
1.0174
1.0062
1.0052
1.0115
1.0177
1.0131
1.0150
1.0117
1.0182
1.0153
1.0206
1.0177
1.0243
1.0200
1.0221
1.0207
1.0235
1.0256
1.0275
1.0237
1.0248
1.0264];
figure
Fs = 1;
L = length(O2_exp);
Y = fft(O2_exp);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
plot(f(2:end),P1(2:end)/max(P1(2:end)),'color','red','linewidth',4)kyle manihttps://nl.mathworks.com/matlabcentral/profile/authors/12990070tag:nl.mathworks.com,2005:Question/7253122021-01-24T02:36:03Z2021-01-24T03:15:19ZInvalid expression in function loading fileHi I've written this function
function [RTxdone] = ReactionTime('resultsfile';sesid)
load 'resultsfile'
Rxtcell = ses(sesid)_results(5:800,6);
RTa = cell2mat(Rxtcell);
for n = 1:225
X = RTa(n:n+8);
Y = [0;0;0;0;0;0;0;0;0];
if X==Y
RTa(n) = NaN
end
end
RT = RTa(RTa~=0)
end
Which when I try to call gives this error:
Error: File: ReactionTime.m Line: 1 Column: 35
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
syntax error. To construct matrices, use brackets instead of parentheses.
Not sure what I've done hereOwen Grayhttps://nl.mathworks.com/matlabcentral/profile/authors/20383725tag:nl.mathworks.com,2005:Question/7249322021-01-23T13:34:44Z2021-01-24T03:07:46ZThe first function is performing the calculations but the second, when ran, won't graph the resultsI'm calling these two functions one after another from a menu created using switch (choice), the first one runs fine as I can see the reults come out but the second does not plot the results of the first.
function [x, v, t] = performcalcs(m, s1, ~, ~, t0, dt, t_total, ~, v, x, g)
i=1;
for t = t0: dt: t_total
F = - s1 .* x(i) - m .* g;
a = F ./ m;
v(i+1) = a .* dt + v(i);
x(i+1) = x(i) + v(i+1) .* dt;
i = i + 1;
end
end
function plotpos(t,x)
plot(t,x,'-');
title('Vertical position of mass');
xlabel('t[s]');
ylabel('x[m]');
end
Gabriel Earlehttps://nl.mathworks.com/matlabcentral/profile/authors/21022551tag:nl.mathworks.com,2005:Question/2888852016-06-09T14:44:13Z2021-01-24T03:07:06ZCause for Matlab error: File on disk might be empty or incomplete.Hi,
I get this error seemingly randomly when saving a file:
File on disk might be empty or incomplete. Ensure there is sufficient free space on your drive and then save the file again. Do not reload the file before you successfully save it.
There is only an "OK" button. When I click "OK" another dialog box comes up stating:  <filename> This file has been modified outside the Matlab editor. Do you want to reload?
The two choices are "yes" and "no". Clicking "No" it seems just returns me to the filename with no file save.
When I click "yes" it appears that the file is reloaded as the Matlab editor scrolls to the end of the file. However, when I run that filename with the code changes, even though the editor shows the changes, the filename is run without those code changes.
Also, I check the filename using Notepad, and the code changes were actually saved.
I have to exit and restart in order to continue.
I am running Windows 7 Enterprise, 64 bit with plenty of hard disk space.
Thank you
Omarhttps://nl.mathworks.com/matlabcentral/profile/authors/52808tag:nl.mathworks.com,2005:Question/7253172021-01-24T02:38:39Z2021-01-24T02:38:39ZPlotting dipole field given in polar coordinatesHello, I'm trying to plot a dipole field around a uniformly polarized sphere.
Here is the setup where u is supposed to represent the field component in r-hat direction and v represents the vector component in theta-hat direction.
[x,y] = meshgrid(-8:0.5:8,-8:0.5:8);
%% for base change
r = sqrt(x.^2 + y.^2); % r in function of (x, y)
theta = atan2(y, x); % theta in function of (x, y)
%% Constants
rad = 2; %radius of sphere
pre = 0.1; %pre factor
scale1=50; %scaling factors for better visibility
scale2=200;
%% Definition of vectors in polar coordinates:
u = ((2*pre)./(r.*r.*r)).*cos(theta); %r-hat
v = (pre./(r.*r.*r)).*sin(theta); %theta-hat
afterwards i go over to plotting the vectors using the quiver function.
I'm not really sure if u*cos(theta) and v*sin(theta) are the right steps here. Basically, I want to plot the vector field given in polar coordinates in cartesian coordinates and I don't know if my transformation steps are correct.
%% plotter
figure(1)
hold on;
for i=1:33
for n=1:33
if((sqrt(x(i,n)*x(i,n)+y(i,n)*y(i,n)))>rad*2)
quiver(x(i,n), y(i,n), u(i,n)*cos(theta(i,n)), v(i,n)*sin(theta(i,n)),scale2,'r')
hold on;
elseif ((sqrt(x(i,n)*x(i,n)+y(i,n)*y(i,n)))>rad)
quiver(x(i,n), y(i,n), u(i,n)*cos(theta(i,n)), v(i,n)*sin(theta(i,n)),scale1,'r')
hold on;
end
end
end
I'm fairly new to matlab so your help is greatly appreciated.
Thank You :)Philipp Traxlerhttps://nl.mathworks.com/matlabcentral/profile/authors/16698957tag:nl.mathworks.com,2005:Question/7250472021-01-23T16:56:28Z2021-01-24T02:33:54Zbisector method help and inputsHello,
I'd like some help with my bissector method as it displays an error message each time I run it.
Error using APFunction
Too many input arguments.
Error in test2 (line 12)
[deflectionL,tL]= APFunction (PForceL,c,k,LoadingDurationL,tstep);
clc;clear;
c=800; k=5000000;
xL=0; xU= 10; Diff=1;
tstep=0.01;
while Diff > 0.01
xM = (xU-xL)/2;
[PForceL,LoadingDurationL] = myfunction(xL);
[PForceU,LoadingDurationU] = myfunction(xU);
[PForceM,LoadingDurationM] = myfunction(xM);
[deflectionL,tL]= APFunction (PForceL,c,k,LoadingDurationL,tstep);
[deflectionU,tU]= APFunction (PForceU,c,k,LoadingDurationU,tstep);
[deflectionM,tM]= APFunction (PForceM,c,k,LoadingDurationM,tstep);
MaxdL= max(deflectionL);
MaxdU= max(deflectionU);
MaxdM= max(deflectionM);
if MaxdM >0.1
xL=xM;
else
xU=xM;
end
Diff = abs(MaxdM-0.1);
endhenry Jokhttps://nl.mathworks.com/matlabcentral/profile/authors/21180735tag:nl.mathworks.com,2005:Question/7252422021-01-23T22:53:50Z2021-01-24T02:19:30ZMissing toolbox Parallel computing why am i missing the parallel computing toolbox and the curve fitting toolbox. I recently downloaded R2020b update and these two are missing.JAY CAMERONhttps://nl.mathworks.com/matlabcentral/profile/authors/6805609tag:nl.mathworks.com,2005:Question/7243182021-01-22T16:37:31Z2021-01-24T02:17:09Zusing fwrite for multiple data type at onceI am trying to write a vector of data of various data types (all numeric) to a .binary file all at once instead of having to loop through the data set. I have a vector that contains the numbers:
myData = [1 3.5 400 75 2.5 6 1];
and then each number has an associated data type:
myDataType = {'single','double','single','single','double','single','single'};
Is there a way to use the fwrite function to write all the data of varying types at once? Such as:
fwrite(fid,myData,myDataType)
This command doesnt work as fwrite. know that for this example that i am giving it would be just as fast to loop through the data and write them to the file one at a time using:
for n = 1:length(myData)
fwrite(fid,nyData(n),myDataType{n})
end
however the data vector i am writing contains thousands of different data and the format of the data type does not follow any particular set pattern and changes. typically, when all the data is the same such as a vector containing 10,000 double values, it is expoenntially faster to write all of the data at once like this:
fwrite(fid,myData,'double')
than it is to use a for loop. But for my specific case, the data types change. Any help would be greatly appreciated.Eric Alexanderhttps://nl.mathworks.com/matlabcentral/profile/authors/16589662tag:nl.mathworks.com,2005:Question/7252822021-01-24T01:01:47Z2021-01-24T02:07:07ZIs it possible to tell what matlab is "Busy" with? Hi,
Maybe a silly question, but it's just out of curiosity.
When matlab is stuck at "Busy" or is taking a really long time to execute a command, is it at all possible to see what it's doing live? Or if not, find out what part of the command it is/was stuck on?
Thanks in advanceDavid Mabwahttps://nl.mathworks.com/matlabcentral/profile/authors/15255963tag:nl.mathworks.com,2005:Question/7252072021-01-23T21:01:12Z2021-01-24T01:48:13Zfly fishing rod simulationHi.
I am an italian fly fishing rodbuilder and I would like to understand how to simulate a bamboo rod physics with classic mechanics math.
Known parameters are:
shape (basicly hexagonal, six bamboo stripes glued with epoxy, but the rod could be penta or quad), distance of two opposite faces at every N inches or Cm, density, MOE (modulus of elasticity), variation of MOE at different depths from rod surface, rod's components, their weights and their position along or outside the rod itself (top ring, guides, line inside and outside the rod etc etc).
the simulation system should include a support where to fix the rod that can move it in various ways: for example the rod is vertical and the handle is traslated vertically back and forth (1 to 2 feet) with an arbitrary frequency.
the final scope of the project is to provide an interface to modify parameters in metric or Imperial measure system (rod taper i.e. the dimensions of the rod for its whole length, or stresses in a particular zone of the rod), and obtain back graphs of stress/strain, 3d simulation of rod movements due to traslation, structural limits of the system (alarms in case of maximum strain reached).
the simulation can be surely more complex respect all above explanations... but is intended that I don't want someone to resolve the simulation and give me the final result, I am "only" looking for suggestions about what Matlab modules/products could fit better to my project to acquire them and start learning how to use them.
thanks in advance
Michelemichele montessorohttps://nl.mathworks.com/matlabcentral/profile/authors/21182962tag:nl.mathworks.com,2005:Question/7247382021-01-23T07:39:50Z2021-01-24T01:43:40ZSubtracting XYZ coordinates defined by matricesI have two matrices, A (96100x3) and B(16416x3). I need to subtract the XYZ coordinates defined by the columns of B from those of A. But as they are of different resolutions, the difference or setxor is still giving sort of union of these two matrices.
Is there any way I can subtract the region bounded by B from A?
TIA Isaac Johnhttps://nl.mathworks.com/matlabcentral/profile/authors/21022777tag:nl.mathworks.com,2005:Question/7245632021-01-22T21:54:08Z2021-01-24T01:17:18ZReplacing empty cells using for loopHi there, I have 796x1 cell array consisting of 1x1 scalar arrays, or empty arrays. E.g.
>> ses1_results = {1.192;0;0;0;0.5678;0;0;0;0;0;0;1;[];1}
ses1_results =
14×1 cell array
{[ 1.1920]}
{[ 0]}
{[ 0]}
{[ 0]}
{[ 0.5678]}
{[ 0]}
{[ 0]}
{[ 0]}
{[ 0]}
{[ 0]}
{[ 0]}
{[ 1]}
{0×0 double}
{[ 1]}
The spacing of the 0s is irregular
I need to remove all the cells with 0, whilst maintaining the 0x0 cells and the values>0, and then convert that into an array. How can I do this? I've spent a few hours trying to do it like this but can't seem to figure it out:
Rxtcell = ses1_results(5:800,6);
for n = 1:796
Z = []
Q = 0
x = Rxtcell(n)
if 1 == strcmp(x,Q)
Rxtcell{n}=[999];
elseif 1== strcmp(x,Z)
Rxtcell(n)= [0];
else
end
end
RxTa = cell2mat(Rxtcell)Owen Grayhttps://nl.mathworks.com/matlabcentral/profile/authors/20383725tag:nl.mathworks.com,2005:Question/7252922021-01-24T01:04:55Z2021-01-24T01:16:41ZFunction as an integratorHi everybody,
I'm computing a numerical solution by Euler's method for a second order differential equation, I have defined the function for the differential equation but I also need to define an additional one as an integrator (like ode45), but by Euler's method. I've tried some computations and agorithms but it does not work. Please, could you help me?
This is my code:
% Sampling interval
h = 0.1;
%h = 0.05;
%h = 0.01;
t0 = 0; % Initial time
tf = 4; % Final time
t = [t0:h:tf]; % Time vector
% Initial value problem
th0 = pi/40; % theta(t0)
om0 = 0; % ommega(t0)
yu = [th0 om0];
e = euler(@yprime,t,h,yu); % Want to call euler's function as an integrator but does not work and has an issue with * multiplication
function [yp] = yprime(t,y)
L = 0.61;
G = 9.81;
yp = zeros(2,1);
yp(1) = y(2); % Angle theta [rad]
yp(2) = (-G/L)*sin(y(1)); % Angular velocity omega [rad/s]
end
% and my Euler's function as a script:
function eu = euler(yp,t,h,y)
% Function that computes the values of the angle theta followinf the Euler
% method
eul = y + yp*h;
eu = eul;Hugo Hernández Hernándezhttps://nl.mathworks.com/matlabcentral/profile/authors/19945880tag:nl.mathworks.com,2005:Question/7252972021-01-24T01:13:59Z2021-01-24T01:13:59Zvariable displacement Hydraulic motorhello guys do anyone know how to control the displacement of a (variable displacement hydrualic motor) in simulink. I cant find any exemple that describe how to control the motor displacement. I want to control the motor displacement via a solenoid valve.
Any tips will help
Thanks Omari Diallohttps://nl.mathworks.com/matlabcentral/profile/authors/11360816tag:nl.mathworks.com,2005:Question/932972010-01-27T23:56:00Z2021-01-24T00:51:43ZWhy does the MathWorks installer fail to start on Windows?I am trying to install MATLAB on a Windows computer, but the installer will not run.
MathWorks Support Teamhttps://nl.mathworks.com/matlabcentral/profile/authors/4622813tag:nl.mathworks.com,2005:Question/7252522021-01-23T23:20:04Z2021-01-24T00:49:57ZPrint first few lines of outputSuppose I do
summary(T)
Then it will print out statistics of all the variables in the table, which is good. But at the same time it will output all the information and will create "auto-scroll" that is very cumbersome. Thus I want to print out the first five lines of the output.
head(summary(T),5)
does not work. alpedhuezhttps://nl.mathworks.com/matlabcentral/profile/authors/10930090tag:nl.mathworks.com,2005:Question/7251122021-01-23T18:11:31Z2021-01-24T00:45:45Znested loops for 2 different variablesThis is the code I am trying to run, and I am unsure what is wrong with my nested loops.
Context: I am trying to the find the different values of c and l and calculate the associated costs Cc and Cl for both values . Ultimately I'd like to plot both results to see which combinations of c and l are cheapest. Thank you.
clc;clear;
a=0;
c= 200:10:1200;
l= 1:0.5:7;
for i=1:length(c)
for j=1:length(l)
Cc = (10*c)-2000;
Cl = 900+825*l.^2-1725*l;
a=a+c+l;
end
endMichaelhttps://nl.mathworks.com/matlabcentral/profile/authors/14342281tag:nl.mathworks.com,2005:Question/2471592015-10-06T22:12:41Z2021-01-24T00:38:33ZHow do you run the Activation Client?MATLAB R2015b won't open on my computer. Pop up says my license checkout has failed (License Manager error-9). Where can I find the Activation client to reactivate my license?Molly Smithhttps://nl.mathworks.com/matlabcentral/profile/authors/7060849tag:nl.mathworks.com,2005:Question/7252472021-01-23T23:15:00Z2021-01-24T00:14:43Zhow do i combine two bar graphsI have tried to combine these two graphics in many ways but nothing works for me, just as the creation of the legends gives me an error. I need help for this because neither the combination nor the legends want to serve me, Thank you!
b1=bar(app.CasosUIAxes,data1.dateRep,data1.cases);
hold on
%grafica de barras 2
b2=bar(app.CasosUIAxes,data2.dateRep,data2.cases);
hold off
legend(app.CasosUIAxes,[b1 b2],'Bar Chart 1','Bar Chart 2')Diego Monsavehttps://nl.mathworks.com/matlabcentral/profile/authors/12163527