https://nl.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-09-20T05:42:43Ztag:nl.mathworks.com,2005:Question/3574692017-09-20T02:52:18Z2017-09-20T05:42:43Zループ文での画像ファイルの移動<p>imageDatastoreを使って画像を読み込んで、一つ一つの画像の大きさを調べて、
20pixel以下の時には、その画像ファイルを移動させるものを作りたいのです。
しかし、ループ文中でのmovefileの『’k.jpg’』部分が間違っていることは分かったのですが、
画像ファイルを指定する方法がわかりません。
どのようにするのが、ベストか教えてください。
よろしくお願いします。</p><pre class="language-matlab">numfiles = length(dir('*.jpg'));
ImTrain = imageDatastore('./','IncludeSubfolders',false,'FileExtensions','.jpg','LabelSource','foldernames') ;
Tx=readall(ImTrain);
for k = 1:numfiles
[w,h,z]=size(Tx{k});
if (w<20)&& (h<20)
movefile('k.jpg','\Documents\MATLAB\Zostera\');
end
end
</pre>KENjihttps://nl.mathworks.com/matlabcentral/profile/authors/6991542-kenjitag:nl.mathworks.com,2005:Question/3573592017-09-19T11:47:47Z2017-09-20T05:42:33Zcan multibody models be used alongwith simscape electronics models?? <p>I have created one simple oscillating body in simscape multibody. I want to attach accelerometer and gyroscope blocks to that body . Is it possible??</p>shreyas joshihttps://nl.mathworks.com/matlabcentral/profile/authors/10860837-shreyas-joshitag:nl.mathworks.com,2005:Question/2220982015-06-02T14:33:20Z2017-09-20T05:41:29Zhow can I simulate distance relay to protect HVDC transmission line and distance relay m.file code in matlab<p>i need the simulation of distance relay in matlab for HVDC transmission line protection and it's m.file</p>heba mahmoudhttps://nl.mathworks.com/matlabcentral/profile/authors/6516076-heba-mahmoudtag:nl.mathworks.com,2005:Question/3574812017-09-20T05:32:34Z2017-09-20T05:32:34ZHi, I am trying to deploy the a program to Aurdino Uno hardware from simulink but i am getting error as below. i don't know how to resolve it please help me....<p>### Generating code into build folder: E:\MATLAB\LED_BLINK_Aurdino_ert_rtw
### Invoking Target Language Compiler on LED_BLINK_Aurdino.rtw
### Using System Target File: C:\Program Files\MATLAB\R2017a\rtw\c\ert\ert.tlc
### Loading TLC function libraries
### Initial pass through model to cache user defined code
.
### Caching model source code
### Writing header file LED_BLINK_Aurdino.h
### Writing header file LED_BLINK_Aurdino_types.h
.
### Writing source file LED_BLINK_Aurdino.c
### Writing header file rtwtypes.h
### Writing header file LED_BLINK_Aurdino_private.h
### Writing source file LED_BLINK_Aurdino_data.c
### Writing header file rtmodel.h
.
### Writing source file ert_main.c
### TLC code generation complete.
### Evaluating PostCodeGenCommand specified in the model
### Using toolchain: Arduino AVR v1.6.13 | gmake (64-bit Windows)
### 'E:\MATLAB\LED_BLINK_Aurdino_ert_rtw\LED_BLINK_Aurdino.mk' is up to date
### Building 'LED_BLINK_Aurdino': "C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f LED_BLINK_Aurdino.mk all</p><p>E:\MATLAB\LED_BLINK_Aurdino_ert_rtw>cd .</p><p>E:\MATLAB\LED_BLINK_Aurdino_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f LED_BLINK_Aurdino.mk all ) else ("C:\PROGRA~1\MATLAB\R2017a\bin\win64\gmake" -f LED_BLINK_Aurdino.mk )
C:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/bin/avr-g++ -std=gnu++11 -fpermissive -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10613 -MMD -MP -MF"MW_digitalio.dep" -MT"MW_digitalio.o" -Os -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -D_RUNONTARGETHARDWARE_BUILD_ -DMODEL=LED_BLINK_Aurdino -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DRT -DMW_TIMERID=1 -DMW_PRESCALAR=1024 -DMW_TIMERCOUNT=62411 -DMW_SCHEDULERCOUNTER=1 -D_RTT_BAUDRATE_SERIAL0_=9600 -D_RTT_ANALOG_REF_=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=1 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DSTACK_SIZE=64 -DRT -DMODEL=LED_BLINK_Aurdino -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -IE:/MATLAB -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include/sf_runtime -IE:/MATLAB/LED_BLINK_Aurdino_ert_rtw -IC:/PROGRA~1/MATLAB/R2017a/extern/include -IC:/PROGRA~1/MATLAB/R2017a/simulink/include -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017a/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/arduino/avr/variants/standard -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/libraries/Servo/src -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017a/3P.instrset/arduinoide.instrset/arduino-1.6.13/hardware/tools/avr/avr/include/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/shared/externalmode_daemon/include -o MW_digitalio.o C:/ProgramData/MATLAB/SupportPackages/R2017a/toolbox/target/supportpackages/arduinobase/src/MW_digitalio.cpp
The system cannot find the path specified.
gmake: <b>*</b> [MW_digitalio.o] Error 1
E:\MATLAB\LED_BLINK_Aurdino_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
E:\MATLAB\LED_BLINK_Aurdino_ert_rtw>An_error_occurred_during_the_call_to_make
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Creating HTML report file LED_BLINK_Aurdino_codegen_rpt.html
### Build procedure for model: 'LED_BLINK_Aurdino' aborted due to an error.
Error(s) encountered while building "LED_BLINK_Aurdino":
### Failed to generate all binary outputs.</p>sadashiv shiarburhttps://nl.mathworks.com/matlabcentral/profile/authors/10823674-sadashiv-shiarburtag:nl.mathworks.com,2005:Question/3056272016-10-04T05:21:41Z2017-09-20T05:27:28Z2016b - How to install both DVDs silently?<p>Hi,</p><p>In previous versions of MATLAB, there was one ISO file, and the initialization file for silent installation was pretty straight forward.</p><p>Today I went to download 2016b, and noticed there were two DVDs. Thinking one is the main installation, and the second was extras, I downloaded both and setup the initialization file in DVD1 (did nothing with DVD2), and ran the Linux install script for a silent install like I normally do.</p><p>At the end of the end of the script, "Info: Eject DVD 1 and insert DVD 2 to continue." popped up thousands of times in my terminal window, and would have continued indefinitely had I not killed the process.</p><p>Thanks to the constantly repeating "Info: Eject DVD 1 and insert DVD 2 to continue." message, in the 30min I stepped away from my computer to let the install finish, the log file for the installation grew to 3.9GB, which is ridiculous. That kind of log file growth could bring down a system by using all the free space on a drive in a very short time.</p><p>With all that now said, how do we perform a silent installation of 2016b if two DVD/ISO files are required? And what is the second DVD? The readme in DVD1 doesn't mention DVD2, and DVD2 has no readme.</p><p>Thanks,
Ron</p>Ronhttps://nl.mathworks.com/matlabcentral/profile/authors/2846929-rontag:nl.mathworks.com,2005:Question/3574792017-09-20T05:26:07Z2017-09-20T05:27:58ZBasic plotting using bar function: is my solution correct?<img src = "/matlabcentral/answers/uploaded_files/88494/IMG_2053.JPG"><p>X vector range 1 to 100 in steps of 5.
Y vector is square root of each x value.
Use bar function.</p>Tayeeba Tarannumhttps://nl.mathworks.com/matlabcentral/profile/authors/11015686-tayeeba-tarannumtag:nl.mathworks.com,2005:Question/3574802017-09-20T05:26:33Z2017-09-20T05:26:33ZHow may I extrapolate a point from a rigid 3d body?<p>Hello, I have x,y,z data for four fixed points on a rigid body i.e:</p><pre class="language-matlab">Tx Ty Tz
97.352 -120.289 -958.28
109.696 -144.125 -945.219
155.972 -118.524 -929.248
125.658 -101.497 -949.232
</pre><p>where each row is the coordinate for the different markers (R1=A, R2=B R3=C, R4=D) on the rigid body (see picture)</p><img src = "/matlabcentral/answers/uploaded_files/88492/Screen%20Shot%202017-09-20%20at%203.15.14%20pm.png"><p>.</p><p>I would like to extrapolate the point alone the vector between A and C x-cm from C (the tip of the tool that the rigid body is attached to).</p><p>I know that extrapolating a linear vector alone A-B does not work as it does not preserve the rotational relations between points A-D on the rigid body. May someone explain how may I preserve the rotation and translation between the rigid points in order to estimate the tip position (as per the following image)</p><img src = "/matlabcentral/answers/uploaded_files/88493/Screen%20Shot%202017-09-20%20at%203.24.38%20pm.png"><p>?</p><p>Any advice would be greatly appreciated. Many thanks.</p>ChrisHhttps://nl.mathworks.com/matlabcentral/profile/authors/4116163-chrishtag:nl.mathworks.com,2005:Question/3571552017-09-18T10:23:44Z2017-09-20T05:22:49ZHow to calculate FWHM of beam profile<p>Hi,</p><p>I had acquired an image. After that, I plotted a beam profile from that image (as shown in attached picture below). I need to evaluate the FWHM of that beam profile in order to obtain distance between two point at half of maximum value.</p><p>The other problem I had faced is the noisy at pixel number 51 - 52.</p><p>My idea is to eliminate the noisy pixels and evaluate the FWHM. But, I dont know how to do it since the beam profile was flipped. Anyone know how to do it?</p><p>Thank you.</p><img src = "/matlabcentral/answers/uploaded_files/88297/beamprofile.PNG">KShttps://nl.mathworks.com/matlabcentral/profile/authors/8837594-kstag:nl.mathworks.com,2005:Question/3574402017-09-19T20:43:53Z2017-09-20T05:21:35ZFinding points of zero slope from 3D function<p>I will be fitting 3D differences of Gaussians to data, and from these fits I want to be able to identify troughs and peaks (points of zero slope) in my resultant functions. I <i>can</i> compute XYZ data points and look for local maxima, but the results are not satisfactory, at least the way I am doing it.</p><p>Below is a sample script showing my problem:</p><pre class="language-matlab">syms a1 a2 b1 b2 b3 b4 c x x0 y y0
</pre><pre class="language-matlab">DoG3D(a1, a2, b1, b2, b3, b4, c, x, x0, y, y0) = ...
(a1 * exp(-1/2 * (((x - x0)/b1)^2 + ((y - y0)/b2)^2))) - ... % Gaus 1
(a2 * exp(-1/2 * (((x - x0)/b3)^2 + ((y - y0)/b4)^2))) + ... % Gaus 2
c;
</pre><pre class="language-matlab">% The constants below will differ, depending on a fit, but here are some
% convenient ones
% a1 a2 b1 b2 b3 b4 c x x0 y y0
DoG3DFit(x, y) = DoG3D(-50, -25, 50, 150, 100, 300, 10, x, 220, y, 180);
</pre><pre class="language-matlab">pretty(DoG3D)
</pre><pre class="language-matlab">figure
subplot(2, 2, 1)
fsurf(DoG3DFit, [-1000, 1000])
daspect([50, 50, 1])
</pre><pre class="language-matlab">% Trying to solve it numerically is unsatisfactory (at least this way)
[X, Y] = meshgrid(-1000:1000, -1000:1000);
matDoG3DFit = matlabFunction(DoG3DFit);
Z = matDoG3DFit(X, Y);
Zpoints = or(imregionalmax(Z), imregionalmax(-Z));
subplot(2, 2, 2)
imagesc(Zpoints)
axis image xy
</pre><pre class="language-matlab">% In 2D, this is easy
DoG(a1, a2, b1, b2, c, x, x0) = ...
a1 * exp(-1/2 * (((x - x0)/b1)^2)) - ... % Gaus 1
a2 * exp(-1/2 * (((x - x0)/b2)^2)) + ... % Gaus 2
c;
pretty(DoG)
</pre><pre class="language-matlab">zeroPoints = solve(diff(DoG(-50, -25, 50, 150, 10, x, 220), x) == 0, x);
subplot(2, 2, 3)
fplot(DoG(-50, -25, 50, 150, 10, x, 220), [-1000, 1000])
hold on
scatter(zeroPoints, DoG(-50, -25, 50, 150, 10, zeroPoints, 220), 'r')
</pre><pre class="language-matlab">% How do I do the same in 3D?
</pre><p>I am hoping there is a way, using the Symbolic Math or other toolbox, to generate formulae that will describe the locations where the slope is zero. These should be, to my understanding, at point (x0, y0), and then at points around the rim of the "caldera." The location of those points will depend upon what constants I supply DoG3D, above.</p><p>If this were a 2D difference of Gaussians, I would simply take the derivative and solve for 0, but I do not know what the equivalent approach is for a 3D function.</p><p>Can someone please help me to achieve this? Or is there no such solution?</p>x I'm tchttps://nl.mathworks.com/matlabcentral/profile/authors/639877-x-i-m-tctag:nl.mathworks.com,2005:Question/2644082016-01-19T23:00:54Z2017-09-20T05:20:54ZNeed to generate tform matrix from triangle parameters.<p>If a user draws a triangle with parameters b, h and theta and wants to change an entire image via a transformation from a new triangle with user inputed parameters b', h', theta'. How can the transformation matrix be found?</p><img src = "/matlabcentral/answers/uploaded_files/43689/question.jpg">Marshallhttps://nl.mathworks.com/matlabcentral/profile/authors/6809551-marshalltag:nl.mathworks.com,2005:Question/771422013-05-27T21:35:26Z2017-09-20T05:11:35ZFuture value prediction with neural network method and right input and target format data<p>Hello,
Could anyone explain, how to do following with matlab neural network NARX method
I have six variables numbers (they depends on each other) for each day and for 10 days.</p><ul><li></li><li>day1 x1, x2, x3, x4, x5, x6</li><li>day2 x1, x2, x3, x4 ,x5,x6</li><li>..........................</li><li>day10 x1, x2, x3, x4, x5, x6</li></ul><p>and I want to predict these six variables for 11th day using matlab neural network
So prediction:</p><ul><li>day11 y1,y2,y3,y4,y5, y6</li></ul><p>I am starting to work with neural networks, so I know that I have to use</p><p>ntstool and to select NARX method, but there I stopped with right format of data at matlab work space variables table. Could anyone please help how to enter input and target data in right format for this case at matlab work space variables table that could allow to simulate this.</p>Povi Nikehttps://nl.mathworks.com/matlabcentral/profile/authors/1622952-povi-niketag:nl.mathworks.com,2005:Question/3574042017-09-19T15:29:59Z2017-09-20T05:10:40ZXLSread error started?<p>I keep getting this error</p><pre class="language-matlab">Error using xlsread (line 260)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: Open method of Workbooks class failed
Help File: xlmain11.chm
Help Context ID: 0
</pre><p>The script worked before, I changed a few values in my excel file and now I've got this error every time.</p><p>Any ideas why?</p><p>I've tried clearing the COM ADD INs in excel, restarted my PC a few times, made sure no other programs are running the same time as matlab, my file is directly in the working directory so it isn't a file path problem, any other ideas?</p><p>It's very frustrating!</p>Ben Sheardhttps://nl.mathworks.com/matlabcentral/profile/authors/10692659-ben-sheardtag:nl.mathworks.com,2005:Question/3571872017-09-18T14:21:14Z2017-09-20T05:07:57ZI have problem in loading my dataset. I'm using MATLAB R2017a. It shows me an error like "Unknown text on line number 1 of ASCII file"<p>load('duplicate_dataset.csv');</p>sarath chandrika balajihttps://nl.mathworks.com/matlabcentral/profile/authors/10804328-sarath-chandrika-balajitag:nl.mathworks.com,2005:Question/3574782017-09-20T05:06:31Z2017-09-20T05:06:31ZWhat does 'in steps of something' mean in the range od value?<img src = "/matlabcentral/answers/uploaded_files/88484/IMG_2052.JPG"><p>Plot exp(x) for values of x ranging from -2 to 2 in steps of 0.1
Here what does 'steps of 0.1' mean? Is it getting x value from -2:2 pausing 0.1?</p><p>I am assuming x = -2:0.1:2
Am I right?</p>Tayeeba Tarannumhttps://nl.mathworks.com/matlabcentral/profile/authors/11015686-tayeeba-tarannumtag:nl.mathworks.com,2005:Question/3574772017-09-20T05:04:59Z2017-09-20T05:04:59Zhybrid SPIHT and fractal to compress image <p>Dose anyone can help me with the algorithm of hybrid method</p>Noor Abbashttps://nl.mathworks.com/matlabcentral/profile/authors/6224106-noor-abbastag:nl.mathworks.com,2005:Question/3574762017-09-20T05:01:13Z2017-09-20T05:06:44ZI have tried solving DFT but i am getting an error<p>Here is my code:
i tried solving using matrix multiplication</p><pre> f1=7;f2=21;
fs=220; %Sampling frequency f2*10
ts=1/fs; %sampling time
t=0:10-ts;
y=sin(2*pi*t*f1)+sin(2*pi*t*f2); %given data set
N=length(y);
n = 0:1:N-1; % row vector for n
k = 0:1:N-1; % row vecor for k
WN = exp(-1j*2*pi/N); % the w elements
n1= transpose(n);
nk = n1*k; % creates a N by N matrix of nk values
WNnk = WN .^ nk; % DFT matrix
Xk = WNnk.*y;
plot(n,xk)</pre><p>Here is my error message:</p><p>Error using .*
Matrix dimensions must agree.</p><p>Error in a21 (line 13)
Xk = WNnk.*y;</p><p>Please help me plot:</p>Sam17https://nl.mathworks.com/matlabcentral/profile/authors/10852409-sam17tag:nl.mathworks.com,2005:Question/3574752017-09-20T04:50:30Z2017-09-20T04:50:30ZHow can I know the elements of a confusion matrix?<p>Hi, I have a doubt about the confusion matrix.</p><p>I obtained the confusion matrix after I used a Neural Network, but How can I know what elements are part of the values of the True Negative or False Positive in the confusion matrix?</p><p>Thanks for your help</p>Juan Carlos Torreshttps://nl.mathworks.com/matlabcentral/profile/authors/10508847-juan-carlos-torrestag:nl.mathworks.com,2005:Question/3574722017-09-20T03:43:22Z2017-09-20T04:49:19ZHow do you extract even columns and even rows from an nxn matrix?<p>How do you extract even columns and even rows from an nxn matrix?</p><p>I have a matrix of 2574 x 5148 and I only need the even columns and even rows.</p><p>Thanks!</p>Miguel Lhttps://nl.mathworks.com/matlabcentral/profile/authors/6796184-miguel-ltag:nl.mathworks.com,2005:Question/3574562017-09-19T23:56:19Z2017-09-20T04:49:03ZI am getting a syntax error with +<p>I need to calculate the value of y for a hw problem using an element by element operation but the first + is giving me a syntax error and I have no idea what I did wrong. (sorry for the abundance of parenthesis, this is the only way I could figure it out). Where I have the first (t.+1) the + is giving me an error</p><pre class="language-matlab">t=[0,1,2,3,4,5,6,7,8];
y=((20.*t.^(2/3))/(t.+1))-(((t.+1)^2)/(e^((.3.*t)+5)))+(2/(t.+1))
</pre>Kimberly Siwekhttps://nl.mathworks.com/matlabcentral/profile/authors/8828416-kimberly-siwektag:nl.mathworks.com,2005:Question/3574742017-09-20T04:44:06Z2017-09-20T04:44:06ZHow to plot trajectory like this?<img src = "/matlabcentral/answers/uploaded_files/88481/liulu.png"><img src = "/matlabcentral/answers/uploaded_files/88483/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20170920103817.png"><p>hello all!
I want to plot a trajectory with custom marker such as ships, but i don't know how to plot this.</p><p>I would appreciate if you can give me some advices!</p>Eric23333https://nl.mathworks.com/matlabcentral/profile/authors/10567835-eric23333tag:nl.mathworks.com,2005:Question/3564722017-09-13T09:34:35Z2017-09-20T04:40:41Zdivide image into overlapping blocks<p>Hi, Can anybody tell me how to divide an image into overlapping blocks and apply svd to each block. Any help in this regard is highly appreciated. This is my code snippet.</p><pre class="language-matlab">L = 1;
fu = @(block_struct) svd(block_struct.data);
J = blockproc(LL{L}, [16 16], fu);
</pre><p>When i run this i dont get error but the "J" do not satisfy (M-B+1)X(N-B+1). Anybody if knows how to do it can share his view. Thanks in advance.</p>TUSHAR MURATKARhttps://nl.mathworks.com/matlabcentral/profile/authors/5239754-tushar-muratkartag:nl.mathworks.com,2005:Question/3568182017-09-15T09:03:31Z2017-09-20T04:21:16ZHow to make output single column in the same line as your calculation<p>Hi there. Whether my google and matlab searching is just crap or it hasn't been asked i can't find the answer to the above question. I've found that you can make something into one column using A(:) or 'reshape', but i wan't to make a single column vector in the same line as the calculation to avoid having a second variable for each i create. e.g. if i could write A=(sqrt(B^2+C^2))(:), that would be great but matlab doesn't accept that. at the moment i am having outputs with 81 columns which is causing Nans in my code with the error saying</p><p>Warning: Matrix is singular, close to singular or badly scaled. Results may be inaccurate. RCOND = NaN</p><p>hat i have done is put in a column vector of 81 numbers, applied the cosine rule rearranged for the angle and it outputs with 81 columns. So a second question, which i have just thought of when writing this, which may precede the first is, 'why is matlab outputting 81 full columns for what should only be a 1*81 column vector?' My code is below,</p><pre class="language-matlab">clear
clc
Spec_Sheet_CR500
</pre><pre class="language-matlab">theta_input=degtorad((-10:0.25:10))
theta=theta_input(:)
</pre><pre class="language-matlab">sh_hyp=sqrt(sh^2+so^2)
sh_a=atan(so/sh)
sh_b=atan(sh/so)
lmh_hyp=sqrt(lmh^2+lmv^2)
lm_to_sm=sqrt((lh+sh)^2+(lo-so)^2)
</pre><pre class="language-matlab">beta_1=sqrt(sh_hyp^2+lmh^2-2*sh_hyp*lmh*cos(sh_b+theta))
beta_1_A=(acos((sh_hyp^2+beta_1.^2-lmh^2)/(2*sh_hyp*beta_1)))
beta_1_B=acos((lmh^2+beta_1.^2-sh_hyp^2)/(2*lmh*beta_1))
beta_2=sqrt(beta_1.^2+lmv^2-2.*beta_1.*lmv.*cos(beta_1_B+(pi/2)))
beta_2_A=acos((beta_1.^2+beta_2^2-lmv^2)/(2*beta_1.*beta_2))
beta_2_B=acos((beta_2^2+lmh_hyp^2-sh_hyp^2)/(2*beta_2*lmh_hyp))
gamma_1=sqrt(lm_to_sm^2+beta_2^2-2*lm_to_sm*beta_2*cos(beta_1_A-beta_2_A-sh_a-psi))
alpha_1_A=acos((link3^2+gamma_1^2-link_arm^2)/(2*link3*gamma_1))
alpha_2_A=acos((lmh_hyp^2+gamma_1^2-lh_hyp^2)/(2*lmh_hyp*gamma_1))
ksi=alpha_2_A+(alpha_1_A-link2_A)
H=sqrt(link1^2+lmh_hyp^2-2*link1*lmh_hyp*cos(ksi))
l=sqrt(beta_2^2+link1^2-2*beta_2*link1*cos(beta_2_B+ksi))
sigma=(acos((sh_hyp^2+l^2-H^2)/(2*sh_hyp*l)))-sh_a
</pre><p>many thanks</p>Ross Hannahttps://nl.mathworks.com/matlabcentral/profile/authors/9219195-ross-hannatag:nl.mathworks.com,2005:Question/3574732017-09-20T04:02:20Z2017-09-20T04:02:20Zhow to plot a ramp funciotn<p>It asks me to plot 2ramp(t)rect((t-1)/2). what code should I use to plot this?</p>Joshua Fosterhttps://nl.mathworks.com/matlabcentral/profile/authors/10852778-joshua-fostertag:nl.mathworks.com,2005:Question/3574662017-09-20T02:35:04Z2017-09-20T03:41:40ZHow can I convert a symbolic array X into a normal matrix for use in lsqcurvefit? <p>I've got a pretty gross three state problem to solve. I don't want to have to redo the algebra for each slightly different case that I apply this code to. So, I did the algebra with symbolic functions. But, I can't figure out how to get my syms array X to output as an array when I try to convert my whole expression using matlabFunction (instead, it turns into X1 X2 X3... in the args for the function).</p><p>Is there a more obvious way to approach this? I feel like there has to be an easy way solve this!</p><p>Any help/comments greatly appreciated. Thanks!</p><pre class="language-matlab">S_1 = 157.4;
S_2 = 166.3;
</pre><pre class="language-matlab">X = sym('X',[1 6]);
syms pKa_p;
</pre><pre class="language-matlab">dOH = S_1 + pKa_p * X(1);
dO = S_2 + pKa_p * X(2);
</pre><pre class="language-matlab">k_p_Y16 = 10^(X(3)*pKa_p - X(4));
k_Y16_Y57 = 10^(X(5)*pKa_p - X(6));
</pre><pre class="language-matlab">frac_1 = 1/(1+k_p_Y16+k_p_Y16*k_Y16_Y57);
frac_2 = k_p_Y16/(1+k_p_Y16+k_p_Y16*k_Y16_Y57);
frac_3 = 1 - frac_1 - frac_2;
</pre><pre class="language-matlab">d_Y16 = frac_1 * dOH + frac_2 * dO + frac_3 * dOH;
func_d_Y16 = matlabFunction(d_Y16);
</pre><p>The output is currently:</p><pre class="language-matlab">func_d_Y16 =
</pre><pre> function_handle with value:</pre><pre> @(X1,X2,X3,X4,X5,X6,pKa_p)........</pre><p>I'd like it to be</p><pre class="language-matlab">func_d_Y16 =
</pre><pre> function_handle with value:</pre><pre> @(X,pKa_p)....</pre><p>where X is represented as X(1) or X(2) accordingly in the following function.</p>cdstarkhttps://nl.mathworks.com/matlabcentral/profile/authors/11014699-cdstarktag:nl.mathworks.com,2005:Question/3574712017-09-20T03:27:24Z2017-09-20T03:35:47ZHow can I create a structure array of large number of individuals who have different attributes?<p>For example if a person has attributes like age,gender,number of siblings how can we represent this in a structure array if there are about 10000 people?</p>thilini rathnayakahttps://nl.mathworks.com/matlabcentral/profile/authors/11015095-thilini-rathnayakatag:nl.mathworks.com,2005:Question/3574202017-09-19T18:15:33Z2017-09-20T03:27:23ZHow to convert a numeric string into a numeric range?<p>I am working with a GUI which allows users to select custom groups of numbers. The inputs are always stored as strings; however, I need to convert the string to a range of numbers.</p><p>For example, if the user inputs...</p><pre class="language-matlab">[1:3,5,7:9]
</pre><p>Then I would like to have a stored value of...</p><pre class="language-matlab">[1, 2, 3, 5, 7, 8, 9]
</pre><p>Is there a way to do this without using eval()?</p><pre class="language-matlab">eval('[1:3,5,7:9]')
</pre><p>I know the use of eval() is frowned upon, but I cannot think of a more efficient method. My only other idea has been to use regexp() which takes much more time because of all the conditional aspects of the search.</p><p><i>Note: I know this can be done in the Command Window, but I am attempting to only use GUI functions or other similar functions that create a pop-up, such as:</i></p><pre class="language-matlab">inputdlg()
</pre>Samuel Claryhttps://nl.mathworks.com/matlabcentral/profile/authors/3218295-samuel-clarytag:nl.mathworks.com,2005:Question/3570472017-09-17T10:47:08Z2017-09-20T03:22:14ZHow to find coefficients in linear combination of functions<p>Hello</p><p>I have faced a problem:
I have three function's made of a experimental data. Say f1(P), f2(P), f3(P) and they all depend on P.
f1(P), f2(P) and f3(P) are in vector form, ie. : f1=[f1value1 f1value2 ... f1valuen] etc. and P=[p1 p2 ... pn]. Where f1valuen, f2valuen, f3valuen and pn are finite, discrete values.</p><p>Finally i have an equation like F(P) = ∝1*f1(P)+∝2*f1(P)+∝3*f3(P).</p><p>My question is: How to find ∝1, ∝2 and ∝3 ?</p><p>I know additionally that ∝1+∝2+∝3=1 and ∝1<∝2 and ∝3<∝2</p>Daniel Wiczewhttps://nl.mathworks.com/matlabcentral/profile/authors/10986665-daniel-wiczewtag:nl.mathworks.com,2005:Question/3574702017-09-20T02:55:00Z2017-09-20T03:06:57ZProblems with issymmetric and sparse matrix<p>I have a real sparse matrix, say A, of size 21660x21660. Here are my observations:</p><pre> 1. Running 0==max(max(abs(A-A'))) returns 1, so I could say that A is symmetric.
2. When I run issymmetric(A), it fails returning 0.
3. Trying issymmetric(A+A') also fails returning 0.
4. Trying issymmetric(full(A)) also fails returning 0.
5. The previous did not fail with a random symmetric sparse matrix of the same size.</pre><p>I'm shocked by number 3. Any thoughts? I'm using version 2016a.</p>Ivan Gonzalez Bustoshttps://nl.mathworks.com/matlabcentral/profile/authors/10124649-ivan-gonzalez-bustostag:nl.mathworks.com,2005:Question/3574652017-09-20T02:19:45Z2017-09-20T03:04:08ZHow to add some values between two points？<p>Dear everyone,
Now I have some coordinates pairs and I want to add more points in the area.</p><p>For example, If I have the dataset</p><pre class="language-matlab">A = [1,2;2,2;1,3;2,3]
</pre><p>I want to get the matrix</p><pre class="language-matlab">B = [1, 2 ; 1.1, 2; 1, 2.1 ;1.1, 2.1; ..... ; 1.9, 2.9; 2.9, 3; 2, 2.9 ; 2, 3 ]
</pre><img src = "/matlabcentral/answers/uploaded_files/88475/1.png"><img src = "/matlabcentral/answers/uploaded_files/88476/2.png"><p>Thanks a lot</p>HONG CHENGhttps://nl.mathworks.com/matlabcentral/profile/authors/8656882-hong-chengtag:nl.mathworks.com,2005:Question/504312012-10-10T20:08:44Z2017-09-20T03:02:38ZWhere can we download R2011b?<p>Send us the link to download R2011b. Thanks.</p>Brianhttps://nl.mathworks.com/matlabcentral/profile/authors/2259405-briantag:nl.mathworks.com,2005:Question/3481342017-07-11T02:55:39Z2017-09-20T03:00:56ZMATLAB sucks (Because of BUGS)<p>I know MATLAB is one of the powerful tool in many field, I write this question because SO MANY BUGS are makes me crazy.</p><p>I use MATLAB 2016a for Image processing and calculating energy resolution about Radiation Detection System. I use webcam class to combine flood images to Real images. But everytime i call webcam instructions supported by MATLAB, MATLAB SHUT DOWN BY ITSELF.</p><p>Besides, I build some GUI environments for testing easily. And there are some loops for collecting data. But MATLAB just escapes from loop even i don't use BREAK. I used infinite loops to check this problem. Maybe I think there are some conditions i didn't notice. BUT HE ESCAPES FROM INFINITE LOOPS EVEN I DON'T USE BREAK.</p><p>That ridiculous 'Paradigm' breaks my concept of programming. Does anyone suffer from these problems?</p>YeeHang Kimhttps://nl.mathworks.com/matlabcentral/profile/authors/10398573-yeehang-kimtag:nl.mathworks.com,2005:Question/2857422016-05-25T05:26:50Z2017-09-20T02:59:29ZFrom plot3 to surface plot<p>I have plotted x,y,z cordinates in a plot3 seen in figure. How can I do a surface plot from these values.</p><img src = "/matlabcentral/answers/uploaded_files/52993/parallel.png">Niklashttps://nl.mathworks.com/matlabcentral/profile/authors/7985296-niklastag:nl.mathworks.com,2005:Question/3571162017-09-18T03:28:48Z2017-09-20T02:57:19ZGetting max and min values in a day for data for 8 months<p>I have data about dissolved oxygen concentration at every half an hour and I wish to calculate the max and minimum values during the day. The data is for about 8 months. Further, I wish to know the time at which I got the maximum values. I am assuming it should be a for loop, however, I am not so sure how to go about it. Any help would be appreciated.</p>Piyush Shaunakhttps://nl.mathworks.com/matlabcentral/profile/authors/10221573-piyush-shaunaktag:nl.mathworks.com,2005:Question/3574682017-09-20T02:49:28Z2017-09-20T02:52:23Zhow to segementation the image<p>i have this <a href = "https://ibb.co/msQW65">image</a>, i wanna remove the background using segmentation so the result show the hand region become white and the background become black, how to do this?</p>Ivan Farezahttps://nl.mathworks.com/matlabcentral/profile/authors/11014770-ivan-farezatag:nl.mathworks.com,2005:Question/3571132017-09-18T02:23:03Z2017-09-20T02:41:33ZHow can calculate compression ratio in Principal component analysis using SVD <p>compression ratio is the rate of original file on the compressed file.
but in PCA tech the ratio= 1024/(2*PrinComps+1)?</p>Noor Abbashttps://nl.mathworks.com/matlabcentral/profile/authors/6224106-noor-abbastag:nl.mathworks.com,2005:Question/3574612017-09-20T01:35:03Z2017-09-20T02:27:38ZIndex exceeds matrix dimensions error?<p>Hello everyone, my code is giving me the error "Index exceeds matrix dimensions. Error in queens (line 11). if test_board(row,col) == 0"</p><p>Im trying to attempt backtracking but cant even get passed looping through my array to place queens because of this error.</p><p>Any help would be appreciated, thanks!</p><pre class="language-matlab">function [queens] = queens(size)
</pre><pre class="language-matlab">test_board = zeros(size,size);
final_board = zeros(size,size);
row = 1; col = 1;
queen_counter = 0;
</pre><pre class="language-matlab">%Loop until "size" number of queens have been successfully placed
while (queen_counter < size)
%Find first safe space and place queen
if test_board(row,col) == 0
test_board(row,col) = 1;
final_board(row,col) = 1;
%Attacking the row and column in which the queen was placed
test_board(:,col) = 8;
test_board(row,:) = 8;
</pre><pre> %Iterate through using temporary variables to keep real
%row and column element in place
temp_row = row;
temp_col = col;
%Attacking lower diagonal
while (temp_col < size && temp_row < size)
temp_row = temp_row + 1;
temp_col = temp_col + 1;
test_board(temp_row,temp_col) = 8;
end</pre><pre> temp_row = row;
temp_col = col;
%Attacking lower diagonal
while (temp_col < size && temp_row > 1)
temp_row = temp_row - 1;
temp_col = temp_col + 1;
test_board(temp_row,temp_col) = 8;
end
%Move to next column after successful queen placement
col = col + 1;</pre><pre> queen_counter = queen_counter + 1;</pre><pre> %Move down one in column if first space isn't safe
else
row = row + 1;
end
end
disp(test_board); disp(final_board);
end</pre>Aaron Cookhttps://nl.mathworks.com/matlabcentral/profile/authors/10166614-aaron-cooktag:nl.mathworks.com,2005:Question/3574622017-09-20T01:40:12Z2017-09-20T02:24:51Zhow to find row position of value in a column?<p>I want to find the row position of a value in a single-column matrix (with inserting the value), how to do that? thanks for answering before.</p>thomi dhiahttps://nl.mathworks.com/matlabcentral/profile/authors/9898792-thomi-dhiatag:nl.mathworks.com,2005:Question/3570222017-09-17T01:33:57Z2017-09-20T02:23:31ZCan you help remove the noise from this audio file?<p>I'm having trouble removing the noise heard from this audio file <a href = "https://www.dropbox.com/s/y4kv3yptdz0pb5h/audio_sample.wav?dl=0">audio_sample.wav</a>.</p><p>I've attempted to use the "butter" function to experiment with removing certain frequencies in an effort to reduce the noise as much as possible.</p><p>You will need to have the audio file in the search path your MATLAB is using.</p><p>The code will play my "current solution".</p><p>Thanks for any help.</p><pre class="language-matlab">%% 1) Load the 'audio_sample.wav' file in MATLAB
[sample_data, sample_rate] = audioread('audio_sample.wav');
</pre><pre class="language-matlab">% a. Plot the signal in time and the amplitude of its frequency
% components using the FFT.
sample_period = 1/sample_rate;
t = (0:sample_period:(length(sample_data)-1)/sample_rate);
subplot(2,2,1)
plot(t,sample_data)
title('Time Domain Representation - Unfiltered Sound')
xlabel('Time (seconds)')
ylabel('Amplitude')
xlim([0 t(end)])
</pre><pre class="language-matlab">m = length(sample_data); % Original sample length.
n = pow2(nextpow2(m)); % Transforming the length so that the number of
% samples is a power of 2. This can make the transform computation
% significantly faster,particularly for sample sizes with large prime
% factors.
y = fft(sample_data, n);
</pre><pre class="language-matlab">f = (0:n-1)*(sample_rate/n);
amplitude = abs(y)/n;
subplot(2,2,2)
plot(f(1:floor(n/2)),amplitude(1:floor(n/2)))
title('Frequency Domain Representation - Unfiltered Sound')
xlabel('Frequency')
ylabel('Amplitude')
</pre><pre class="language-matlab">% b. Listen to the audio file.
% sound(sample_data, sample_rate)
</pre><pre class="language-matlab">%% 2) Filter the audio sample data to remove noise from the signal.
order = 7;
[b,a] = butter(order,1000/(sample_rate/2),'low');
filtered_sound = filter(b,a,sample_data);
sound(filtered_sound, sample_rate)
</pre><pre class="language-matlab">t1 = (0:sample_period:(length(filtered_sound)-1)/sample_rate);
subplot(2,2,3)
plot(t1,filtered_sound)
title('Time Domain Representation - Filtered Sound')
xlabel('Time (seconds)')
ylabel('Amplitude')
xlim([0 t1(end)])
</pre><pre class="language-matlab">m1 = length(sample_data); % Original sample length.
n1 = pow2(nextpow2(m1)); % Transforming the length so that the number of
% samples is a power of 2. This can make the transform computation
% significantly faster,particularly for sample sizes with large prime
% factors.
y1 = fft(filtered_sound, n1);
</pre><pre class="language-matlab">f = (0:n1-1)*(sample_rate/n1);
amplitude = abs(y1)/n1;
subplot(2,2,4)
plot(f(1:floor(n1/2)),amplitude(1:floor(n1/2)))
title('Frequency Domain Representation - Filtered Sound')
xlabel('Frequency')
ylabel('Amplitude')
</pre>Christopher Vergarahttps://nl.mathworks.com/matlabcentral/profile/authors/10875878-christopher-vergaratag:nl.mathworks.com,2005:Question/3574462017-09-19T21:35:19Z2017-09-20T02:10:27ZUnable to create a stochastic under a set of rules.<p>I'm working on code to create a stochastic matrix under the following rules:</p><p><i>If the vector S1 does not have any zero entry, use this vector to modify matrix A into a left-stochastic matrix P by scaling each of its columns by the reciprocal of the corresponding entry of S1. If S1 has a zero entry, use the vector S2 to modify A into a right-stochastic matrix P by scaling each of its rows by the reciprocal of the corresponding entry of S2.</i></p><pre class="language-matlab">S1=sum(A,1);
S2=sum(A,2);
</pre><p>For my function I have this:</p><pre class="language-matlab">for z = 1:size(S1,2)
A(:,z) = A(z,:)/S2(1,z);
disp(A)
break;
</pre><p>An incorrect sample output:</p><pre class="language-matlab">A =
%Original input matrix A
0.5000 0 0
0 0 0
0.5000 1.0000 0.5000
</pre><pre class="language-matlab">P =
%Incorrect output matrix
1.0000 0 0
0 0 0
0 1.0000 0.5000
</pre><p>Any help/advice will be appreciated.</p>kadash 12https://nl.mathworks.com/matlabcentral/profile/authors/11001999-kadash-12tag:nl.mathworks.com,2005:Question/1552242014-09-18T00:09:08Z2017-09-20T02:07:48ZHelp plotting parametric equations<p>Im trying to plot a parametric equation given by
X= 3t/(1+t3) and Y= 3t2/(1+t3), on two intervals in the same window, the intervals are -30≤ t≤ -1.6 and -0.6≤ t≤ 40 I need to use the plot function to plot this
My code for the first interval of t is</p><pre> t= linspace (-30,-1.6);
X= ((3*t)/(1+t.^3);
Y= ((3*t.^2)/(1+t.^3));
plot(x,y)</pre><p>When i try to plot this interval, it just draws up a blank graph, with no function plotted. What am i doing wrong, and also, how would i go about plotting the same function on the second interval, and have both plots visible in the same window of the plot? Any help is greatly appreciated, i apologize for any stupid errors, this is my first time using matlab</p>quentinhttps://nl.mathworks.com/matlabcentral/profile/authors/5655993-quentintag:nl.mathworks.com,2005:Question/3574582017-09-20T00:36:19Z2017-09-20T02:07:34ZHow do I return multiple mxArray values?<p>Suppose I want to write a C function that needs to return multiple mxArray objects. I do not want to use the mexFunction API because I actually have lots of C functions in one DLL that have this requirement.</p><p>Conceptually I want to do the following:</p><pre> mxArray* doSomething(mxArray* inputValue, mxArray** outputValue)
{
*outputValue = mxCreate...();
return mxCreate...();
}</pre><p>I've tried lots of variations but cannot seem to find the right incantation of calllib() to get this to work. I'll either get an error like "Pointer type must match data type", or MATLAB will simply crash. Maybe I'm overthinking it.</p><p>Can someone help me out?</p>Mark Spruiellhttps://nl.mathworks.com/matlabcentral/profile/authors/10704032-mark-spruielltag:nl.mathworks.com,2005:Question/3574592017-09-20T00:37:28Z2017-09-20T02:02:51ZHow to create a convext combination of column vectors?<p>Hi everyone, say I generate a matrix X as such:</p><pre> X = eye(n);</pre><p>How could I create a convex combination of the column vectors of this matrix X? Thanks in advance.</p>Brandon Augustinohttps://nl.mathworks.com/matlabcentral/profile/authors/8853665-brandon-augustinotag:nl.mathworks.com,2005:Question/3574642017-09-20T01:53:01Z2017-09-20T01:53:01Zwhere can I find the simulink model of control tension of web application in video "Virtual Commissioning of Production Machines"? <p>Hi,</p><p>as video"Virtual Commissioning of Production Machines, Part 1: Overview"
https://www.mathworks.com/videos/virtual-commissioning-of-production-machines--part-1--overview-1480445252670.html
shows a good method to control tension of web, could someone tell me where can I download this simulink model and how to contact the author?</p>Jun Luhttps://nl.mathworks.com/matlabcentral/profile/authors/3886480-jun-lutag:nl.mathworks.com,2005:Question/3574632017-09-20T01:41:18Z2017-09-20T01:44:08ZHow to do smoothing and integration on Spirometry experiment data? <p>Hi,
I have data for spirometry experiment and I need to do smoothing and integration to get the volume as shown in the picture below on the left for the first data</p><p>set (Normal breathing). Then I need to do the same thing on dataset #2 (exhale forcefully) to get the flow rate and plot it with the volume and get the second figure on the right shown below as well.
Please, I need some help. Also, I attached the dataset #1 and #2, and the time is just 30 sec for both datasets.</p><p>Thanks in advance</p><img src = "/matlabcentral/answers/uploaded_files/88471/22%20(2).png">Abdullah Bdaiwihttps://nl.mathworks.com/matlabcentral/profile/authors/8363278-abdullah-bdaiwitag:nl.mathworks.com,2005:Question/3573372017-09-19T09:36:08Z2017-09-20T01:34:14Z Matlab codes for systemic risk assessement in banking networks in Ghana<p>Dear Sir/Madam,
I am studying "systemic Risk assessement in banking Network of Ghana. I want you to kindly help me with usefull links to help me run the simulation with MATLAB.</p>Eric agyemanghttps://nl.mathworks.com/matlabcentral/profile/authors/10976076-eric-agyemangtag:nl.mathworks.com,2005:Question/3550862017-09-04T05:32:52Z2017-09-20T01:25:42ZSimulinkでuint8の配列をバスオブジェクトに変換するブロックの記述方法<p>matlab function blockを使うことが考えられますが、
その中でmemcpyに相当することを行うにはどのようにすればよろしいでしょうか。</p><p>もしくは既存のsimulink ブロックを使って行う方法があれば教えてください。</p>tnksralhttps://nl.mathworks.com/matlabcentral/profile/authors/10415639-tnksraltag:nl.mathworks.com,2005:Question/3568042017-09-15T05:47:07Z2017-09-20T01:04:12ZCluster centroid and vector analysis<p>Hello,</p><p>I am running an experiment where subjects are completing a 3d reach task with a tool while I am tracking the tool tip position. As a result, I have a matrix of (x,y,z) coordinates (@ 20Hz) captured from a tool tracking device of the reach between two stationary targets. While the distances between the targets is fixed (4.5cm), the reference frame of the tracking devise is not fixed (as it is a portable device). Subsequently, the tracked target positions are relative across all subjects.</p><p>I have applied the following code to generate a scatter of the centered and rotated data (XYZ):</p><pre class="language-matlab">xyz0=mean(XYZ);
A=bsxfun(@minus,XYZ,xyz0); %center the data
[U,S,V]=svd(A,0);
A_rot = A*V; %V(:,1) is the direction of most variance
A_final = bsxfun(@minus,A_rot,[min(A_rot(:,1)) 0 0]);
scatter3(A_final(:,1),A_final(:,2),A_final(:,3));
</pre><img src = "/matlabcentral/answers/uploaded_files/88129/Screen%20Shot%202017-09-15%20at%203.33.00%20pm.png"><p>I would like to</p><ol><li>Locate the centroid of each target</li><li>determine the vector distance between the target centroids</li><li>determine the time taken to move fro target 1 to target 2</li></ol><p>Is cluster analysis required to determine the cluster centroids? If so, may someone suggest a good reference? If I use the mean of each cluster, how can I determine the time taken to move from target 1 to target 2? I assume that I must find the data point that is closest to the target 1 centroid and count the number of frames between that point and the point nearest target 2's centroid?</p><p>Any advice and/or references would be greatly appreciated. Many thanks!</p>ChrisHhttps://nl.mathworks.com/matlabcentral/profile/authors/4116163-chrishtag:nl.mathworks.com,2005:Question/3574092017-09-19T16:09:25Z2017-09-20T00:57:37ZHow can i replace every second sample with the previous sample in an audio file of format .wav?<p>I have replaces every second sample with 0 and now I need to replace every second sample with the previous sample.</p>Emma Barretthttps://nl.mathworks.com/matlabcentral/profile/authors/11002074-emma-barretttag:nl.mathworks.com,2005:Question/3572862017-09-19T02:16:27Z2017-09-20T00:55:05ZHow to completely reset Matlab's workspace?<p>How can I reset Matlab's workspace (environment) as if I restarted it without actually restarting it (to avoid overhead)? Perhaps specifically to trigger garbage collection?</p><p>This is in order to resolve the problem of Matlab degrading and become slower over time, probably due to poor memory management:</p><p><a href = "https://www.mathworks.com/matlabcentral/answers/331930-can-anyone-explain-why-matlab-gets-slower-and-slower-until-restart-if-large-cell-or-struct-arrays-ar">https://www.mathworks.com/matlabcentral/answers/331930-can-anyone-explain-why-matlab-gets-slower-and-slower-until-restart-if-large-cell-or-struct-arrays-ar</a></p><p><a href = "https://groups.google.com/forum/#!topic/yalmip/VNoBeBKc9vM">https://groups.google.com/forum/#!topic/yalmip/VNoBeBKc9vM</a></p>Zoharhttps://nl.mathworks.com/matlabcentral/profile/authors/2906003-zohartag:nl.mathworks.com,2005:Question/3574602017-09-20T00:48:02Z2017-09-20T00:48:02ZWhat is the range for 'SettlingTimeThreshold' in stepinfo? <p>I want to look at Settling Time Threshold of 0.0001(0.01%) but it splits out NaN.</p>Onn Lim Yonghttps://nl.mathworks.com/matlabcentral/profile/authors/7472672-onn-lim-yong