https://de.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-03-28T13:51:25Ztag:de.mathworks.com,2005:Question/3318962017-03-25T17:31:24Z2017-03-28T13:50:55ZThe Pitch of signal <p>Hello sir,
According to my knowledge pitch of any signal is nothing but its frequency, so if i keep the same frequency of any signal then the audio that we hear should be same right? While I was working with matlab, what I did is, I kept the frequency same but changed the sampling rate(for the same sinusoid), the result is I got the different sound for 2 different sampling rates. How can that be possible? can you please explain it to me?</p><p>Thank you</p>Nachiket Patkihttps://de.mathworks.com/matlabcentral/profile/authors/6912172-nachiket-patkitag:de.mathworks.com,2005:Question/701602013-04-06T15:29:07Z2017-03-28T13:47:45ZFilling a Bounding Box with zeros<p>I am trying to Replace an boxed region with all 0's in a binary image</p><p>BW2 is the image & the object lies at</p><p>[642.5000 1.5000 55.0000 82.0000] (from <b>regionprops-BoundingBox</b>)</p><p>BW2(642.5:697.5,1.5:82.5)=zeros(55,82);-gives"Subscripted assignment dimension mismatch."</p><p>BW2(642.5:697.5,1.5:82.5)=0;-Doesn't replace the regions with zeros</p><p>BW2(642.5:697.5,1.5:82.5)=[0];-Doesn't replace the regions with zeros</p><p>How to do this Change all the pixels to zero with in that box??</p>Vijayhttps://de.mathworks.com/matlabcentral/profile/authors/3952125-vijaytag:de.mathworks.com,2005:Question/3323332017-03-28T13:46:05Z2017-03-28T13:46:05ZQuick Response code Decoder<p>Where can I find a efficient and robust QRcoddecoder algrithom?</p>GAO DA SHUAIhttps://de.mathworks.com/matlabcentral/profile/authors/4227629-gao-da-shuaitag:de.mathworks.com,2005:Question/3322672017-03-28T07:57:46Z2017-03-28T13:44:41ZParsing the Ms access data base<p>I have a database with two tables. I tried to extract the data from the tables and i was able to extract also using the command below,</p><pre class="language-matlab">rs=invoke(hopen,'OpenRecordset','Data');
</pre><pre class="language-matlab">fieldlist=get(rs,'Fields');
</pre><pre class="language-matlab">ncols=get(fieldlist,'Count');
</pre><pre class="language-matlab">for c=1:double(ncols)
</pre><pre> fields{c} = get(fieldlist,'Item',c-1);
resultset.columnnames{c} = get(fields{c},'Name');
end;
nrecs=0;
while get(rs,'EOF') == 0
nrecs = nrecs + 1;
for c=1:ncols
resultset.data{nrecs,c} = get(fields{c},'Value');
end;
invoke(rs,'MoveNext');
end</pre><p>Only problem is when I have a multiple values in the cell i can able to extract only first element in the cell.</p><p>For example,</p><img src = "/matlabcentral/answers/uploaded_files/73583/VehicleProjects.jpg"><p>in the above figure, the column carsSelected consists of multiple value in the cell. In this case i cannot able to extract all the elements in the cell? How can I do this?</p><p>Thanks a lot</p>Gopalakrishnan venkatesanhttps://de.mathworks.com/matlabcentral/profile/authors/4887278-gopalakrishnan-venkatesantag:de.mathworks.com,2005:Question/3323312017-03-28T13:34:29Z2017-03-28T13:44:32ZCreating a loop of a script<p>Hi,</p><p>I need to loop a script but i dont know how with using the for function</p><p>If i copy the script down it will continue on and work but this isn't very productive</p><p>The script is:</p><pre class="language-matlab">t_step=0.1
s_step=0.5 % Distance step of 0.5m
s_Zero=0
s=s_Zero+s_step
t=0
v_Zero=v_Lat
a=0.1; % Long Acceleration
% Loop starts Here
v=v_Zero+(a*t_step);
Tractive_Force_Tyre=mu_Long*((2.006*v*v*wdR)+(g*m*wdR)+(m*a*H/L)); % Zero Acceleration
if v<Max_First
Tf=Tf_First;
elseif (Max_First<v) && (v<Max_Second)
Tf=Tf_Second;
elseif (Max_Second<v) && (v<Max_Third)
Tf=Tf_Third;
elseif (Max_Third<v) && (v<Max_Fourth)
Tf=Tf_Fourth;
elseif (Max_Fourth<v) && (v<Max_Fifth)
Tf=Tf_Fifth;
else (Max_Fifth<v) && (v<Max_Sixth)
Tf=Tf_Sixth;
end
if Tractive_Force_Tyre>Tf;
disp('Engine Limited');
a_end=Tf/m;
else Tf>Tractive_Force_Tyre;
disp('Traction Limited');
a_end=Tractive_Force_Tyre/m;
end
v_Zero=v;
s_Zero=s;
a=a_end;
t_step=((sqrt((2*a.*s)+(v_Zero^2))-v_Zero)/a);
v=v_Zero+(a*t_step);
t=t+t_step;
s=s_step+s;
% Loop Finish Here
</pre>Conor Hardimanhttps://de.mathworks.com/matlabcentral/profile/authors/5045480-conor-hardimantag:de.mathworks.com,2005:Question/3323012017-03-28T10:20:28Z2017-03-28T13:44:27ZHow can I put a timer in my GUI?<p>I want a code that is counting all the time since I press the push button. If the time is 3 s I want to display a message if the time is between 3s and 6s I want another message and between 6s and 20s the final message.</p><p>Could someone help me?</p>Larruzeahttps://de.mathworks.com/matlabcentral/profile/authors/4893470-larruzeatag:de.mathworks.com,2005:Question/3320132017-03-26T17:32:13Z2017-03-28T13:44:09Zfind doesn't work with tables<p>hello</p><p>I'm trying to find the index vector of where appears a value in a one column of a table (not an array nor a cell).</p><p>However, "find" gives me the error shown on the snapshot.</p><img src = "/matlabcentral/answers/uploaded_files/73436/error.png"><p>Any ideas</p>Abdelmoumen Bacettihttps://de.mathworks.com/matlabcentral/profile/authors/2067162-abdelmoumen-bacettitag:de.mathworks.com,2005:Question/3323162017-03-28T11:43:40Z2017-03-28T13:41:25ZHow can I write the code of this problem of TIC /TOC timer?<p>I want a code that is counting all the time since I press the pushbutton1. I have anothe pushbutton2 and when I press it if the time is less or equal to 3 s I want to display on a static or edit text a message, if the time is between 3s and 6s I want another message and between 6s and 20s the final message.</p><p>Could someone help me?</p>Larruzeahttps://de.mathworks.com/matlabcentral/profile/authors/4893470-larruzeatag:de.mathworks.com,2005:Question/3323282017-03-28T13:20:28Z2017-03-28T13:39:56Zhow i solve this problem?<img src = "/matlabcentral/answers/uploaded_files/73606/problem.png">Talat noorhttps://de.mathworks.com/matlabcentral/profile/authors/9687973-talat-noortag:de.mathworks.com,2005:Question/3323322017-03-28T13:38:33Z2017-03-28T13:38:33ZMatlab regularly crashes with start(vid) command<p>I am having issues when trying to start a video object with start(vid): it usually works just fine but after several snapshots, the start(vid) command begins to take a long time until Matlab eventually hangs and crashes. Then I have to reboot both the camera and Matalb, initialize the video object again and start(vid) will work again for another 10-20 snapshots until the problem occurs once more. The code I use is the following:</p><pre class="language-matlab">% First: create the video object (only the first time):
global vid1
vid1 = videoinput('qimaging', 1, 'MONO16_1392x1040'); %Initialize Retiga SRV Camera (QImaging)
set(vid1,'FramesPerTrigger',1);
triggerconfig(vid1, 'hardware', 'fallingEdge', 'TTL' );
src1 = getselectedsource(vid1);
src1.Exposure = Retiga.t_exp;
src1.NormalizedGain=1;
</pre><pre class="language-matlab">% Once created the object vid1, I acquire images through a separate function which can be essentially reduced to:
function I1=take_a_picture()
start(vid1)
[I1, ~]=getdata(vid1);
stop(vid1);
flushdata(vid1);
return
</pre><p>The start(vid1) command takes normally a few fractions of second, then 30 seconds, and eventually Matlab hangs and crashes when executing the command. The camera-PC cable is IEE1394, the camera a Retiga SRV from QImaging. The camera works perfectly in the manufacturer's software. Things I have tried so far without success:</p><ul><li>Run the program in a different Matlab version (2012, 2016)</li><li>Reduce the the pictures' weight by changing the camera mode from 16bits to 8bits</li><li>Change start(vid1) for getsnapshot</li><li>Introduce wait(vid1,60) after start(vid)</li><li>Reinstall the camera's drivers</li></ul><p>I can't figure it out what is causing the problem, as sometimes it works perfectly for 100 sequential snapshots and in other cases it crashes after executing start(vid) only 5-6 times.</p><p>Thank you!</p>amuelashttps://de.mathworks.com/matlabcentral/profile/authors/9297438-amuelastag:de.mathworks.com,2005:Question/3321972017-03-27T19:54:25Z2017-03-28T13:37:47ZSolve a system of Partial Differential Equations using function BVP4C<p>Hello every one. I have a Boundary Value Problem to solve. When I press "run", an error appears: "Warning: Explicit solution could not be found. > In solve at 160". How can I fix my errors. Thank you in advance!</p><p>Below is my Boundary Value Problem and the code:</p><p>BVP problem:</p><p>S'''+3SS''-2*S'*S'+Y-109.963*F=0</p><p>Y''+3*5.076*S*Y'+0.0000007738*F'*Y'+0.00000255*Y'*Y'=0</p><p>F''+3*5.076*42770*S*F'+2.914*Y''=0</p><p>Boundary Conditions:</p><p>x=0 then S=S'=0, Y=1, F=1</p><p>x=infinitive then S'=Y=F=0</p><p>My code:</p><p>Editor window 1:</p><p>clear all; close all; clc;</p><p>init=bvpinit(linspace(0,4,100),[0 0 0 0 0 0 0 0 0])</p><p>sol=bvp4c(@rhs_bvp,@bc_bvp,init);</p><p>x=linspace(0,4,1000);</p><p>BS=deval(sol,x);</p><p>plot(x,BS);</p><p>Editor window 2:</p><p>function rhs=rhs_bvp(x,y)</p><p>rhs=[y(2);y(3);-3*y(1)*y(3)+2*y(2)*y(2)-y(5)+109.963*y(8);y(6);-3*5.076*y(1)*y(6)-0.0000007738*y(9)*y(6)-0.000002255*y(6)*y(6);y(9);-3*5.076*42770*y(1)*y(9)+2.914*3*5.076*y(1)*y(6)+2.914*0.0000007738*y(9)*y(6)+2.914*0.000002255*y(6)*y(6)];</p><p>Editor window 3:</p><p>function bc=bc_bvp(yl,yr)</p><p>bc=[yl(1);yl(2);yl(5)-1;yl(8)-1;yr(2);yr(5);yr(8)];</p>Hiep Hoanghttps://de.mathworks.com/matlabcentral/profile/authors/10032326-hiep-hoangtag:de.mathworks.com,2005:Question/3307762017-03-20T06:04:21Z2017-03-28T13:36:11ZHow do I add a legend to uiaxes in Application Designer?<p>Hello,
I was not able to add a legend to uiaxes in appdesigner. How do we do that? Thanks!</p>morningStarhttps://de.mathworks.com/matlabcentral/profile/authors/1014623-morningstartag:de.mathworks.com,2005:Question/3323292017-03-28T13:27:23Z2017-03-28T13:32:00Zhow to limit search depth on model for report generator<p>Is there a way to limit how deep the report generator will look when creating a report of a single simulink model. I want to get a report on just the top 2-3 layers (my architecture layers) of subsystems, but the standard option digs down to the lowest level which creates a massive report that is too verbose.</p>Nathanhttps://de.mathworks.com/matlabcentral/profile/authors/9626884-nathantag:de.mathworks.com,2005:Question/3323302017-03-28T13:27:41Z2017-03-28T13:27:41ZI am using Mathworks Lithium 2RC battery model as reference for creating my battery model. Since I can't edit the original, what are the other ways I could create those resistors, capacitor blocks ? I couldn't find out those blocks in simscape<p>Need help in order to edit those custom R, C blocks</p>Praveen Kumar Kuppusamyhttps://de.mathworks.com/matlabcentral/profile/authors/7017712-praveen-kumar-kuppusamytag:de.mathworks.com,2005:Question/3311212017-03-21T18:15:47Z2017-03-28T13:25:21ZHow to do inverse continuous wavelet transform from sym8 wavelet domain<p>I use cwt(signal,1,'sym8') to do 1-scale continuous wavelet transform to the sym8 wavelet domain. However, I didn't find the function to do the inverse continuous wavelet transform from the sym8 wavelet domain. The function icwt only applies to 'morse', 'amor', 'bump' wavelet. Anybody has an idea?</p>Rubiohttps://de.mathworks.com/matlabcentral/profile/authors/9371116-rubiotag:de.mathworks.com,2005:Question/3323262017-03-28T13:12:31Z2017-03-28T13:24:55ZHow do I use nlinfit to solve for constants in multiple ordinary differential equations (multiple sets of time dependent data)?<p>Basically, my assignment is to use sets of initial time vs. concentration data for six compounds/entities in nlinfit in order to find the k1, k2, k3, k4, k5 and k6 constants in the six differential equations simultaneously. The differential equations are shown in the code day. k0 was based off of literature values.</p><p>I'm not sure exactly what i am doing wrong. The error i'm getting now is that the dependent variable (c) can't be a matrix, but has to be a vector. However, I have six different variables dependent on time. So, maybe I need to use nlinfit six times, once for each variable? All help is appreciated greatly!</p><p>Here is my code so far code:</p><p>Main file:</p><p>tspan=[0,5,10,15,20,25,30,35,40,45,50]';</p><p>TG=[1,0.361,0.238,0.15,0.145,0.14,0.122,0.117,0.114,0.112,0.111]';</p><p>DG=[0,0.183,0.13,0.101,0.086,0.079,0.075,0.072,0.071,0.070,0.069]';</p><p>MG=[0,0.063,0.035,0.025,0.021,0.019,0.018,0.018,0.017,0.017,0.017]';</p><p>Al=[6,4.655,3.651,3.966,3.630,3.630,3.535,3.515,3.502,3.495,3.491]';</p><p>E=[0,1.745,2.148,2.200,2.369,2.429,2.464,2.484,2.497,2.504,2.508]';</p><p>GL=[0,0.411,0.615,0.702,0.746,0.770,0.784,0.792,0.797,0.799,0.801]';</p><p>c=[TG DG MG Al E GL];</p><p>k0=[0.04, 0.20, 0.225, 1.4, 0.22, 0.088];</p><p>[k, resid, J] = nlinfit(tspan, c, @HW2regress,k0)</p><p>function y = HW2regress(k, tspan)</p><p>k1=k(1); k2=k(2); k3=k(3); k4=k(4); k5=k(5); k6=k(6);</p><p>TG=c(:,1);</p><p>DG=c(:,2);</p><p>MG=c(:,3);</p><p>A=c(:,4);</p><p>E=c(:,5);</p><p>GL=c(:,6);</p><pre> function [dS] = HW2ode(t,c)</pre><pre> %system of ODEs</pre><pre> %TG</pre><pre> dS(1,1)=-k1.*TG.*A+k2.*DG.*E;</pre><pre> %DG</pre><pre> dS(2,1)=k1.*TG.*A-k2.*DG.*E-k3.*DG.*A+k4.*MG.*E;</pre><pre> %MG</pre><pre> dS(3,1)=k3.*DG.*A-k4.*MG.*E-k5.*MG.*A+k6.*GL.*E;</pre><pre> %E</pre><pre> dS(4,1)=k1.*TG.*A-k2.*DG.*E+k3.*DG.*A-k4.*MG.*E+k5.*MG.* k6.*GL.*E;</pre><pre> %A</pre><pre> dS(5,1)=-dS(4,1);</pre><pre> %GL</pre><pre> dS(6,1)=k5.*MG.*A-k6.*GL.*E;</pre><pre> end</pre><p>c0=[1,0,0,0,6,0];</p><p>tspan=[0,5,10,15,20,25,30,35,40,45,50]';</p><p>[t,y]=ode45(@HW2ode,tspan,c0);</p><p>end</p>Daniel Konovalovhttps://de.mathworks.com/matlabcentral/profile/authors/7657358-daniel-konovalovtag:de.mathworks.com,2005:Question/3323192017-03-28T12:28:40Z2017-03-28T13:51:25Zwhat are all possibilities for a,b,c to be 72?<p>a = [0:1:20];
b = [0:1:20];
c = [0:1:20];</p><p>i want to know what all the possibilities are of the product of a*b*c to be 72</p><p>i tried with an if statement but this doesn't work.</p>Quinten Lodewijkshttps://de.mathworks.com/matlabcentral/profile/authors/9962450-quinten-lodewijkstag:de.mathworks.com,2005:Question/3321832017-03-27T18:12:26Z2017-03-28T13:15:47ZUseParallel Option with fmincon<p>Hello,</p><p>I am using fmincon to solve a large dimensioned problem (thousands of variables) and want to turn on the 'UseParallel' option to reduce computational time. Currently I supply fmincon with objective and constraint functions (nonlinear equality) as well as the gradients for these two functions. Before I run fmincon I establish a parallel pool on my local machine using parpool('local') which begins a parallel pool connected to two workers. Next, I run fmincon with the "UseParallel" option set to true. When I do this I receive no errors, however I observe no reduction in speed or any other evidence fmincon is actually computing anything in parallel. It was my understanding that by turning this option on fmincon would compute the gradient and constraints in parallel, but this doesn't seem to be happening. Am I misunderstanding something?</p>repritchett92https://de.mathworks.com/matlabcentral/profile/authors/7985009-repritchett92tag:de.mathworks.com,2005:Question/3323132017-03-28T11:29:10Z2017-03-28T13:11:05ZI have a ecg signal, want to plot the signal between the range 20-30 samples. How can I plot? below is my given code of the given signal <pre class="language-matlab">D = load('16265m.mat');
x1 = D.val;
t = linspace(0,60, size(x1,2));
subplot(2,1,1)
plot(t,x1)
axis tight
xlabel('Samples')
ylabel('Amplitudes')
title('Raw ECG signal')
[z, a]=butter(5,0.5,'low');
x=filter(z,a,x1);
N = length(x1);
t = linspace(0,60, size(x,2))
subplot(2,1,2)
plot(t,x)
axis tight
xlabel('Samples')
ylabel('Amplitudes')
title('Filtered ECG signal')
</pre>Nealhttps://de.mathworks.com/matlabcentral/profile/authors/8751540-nealtag:de.mathworks.com,2005:Question/3089462016-10-24T20:59:33Z2017-03-28T13:09:57ZRecognition of brand and type of vehicle using image processing<p>In my final project I want to find brand and type of vehicle from an input image.I am new on image processing. thats way,I research so much but there are so many different way and I cant combine them all together.</p><p>I create an database which has 4 different car brands and tresholds of 4 different type model such as car truck...</p><p>I try corrlelation but it didnt works. so
which way should I go?</p><p>and sorry for my bad English...</p><p>[Merged from duplicate question]</p><p>Hi I want to detect brand of a car,compare it with database and then learn name of brand. I have 7 logos in my database. Here is my code I used corr but it gives me wrong result.what should I use?</p>Elif Erinhttps://de.mathworks.com/matlabcentral/profile/authors/7734380-elif-erintag:de.mathworks.com,2005:Question/3322332017-03-28T01:41:04Z2017-03-28T13:08:56ZUpdating inverse of a lower triangular matrix<p>Dear All,</p><p>I need to solve a matrix equation Ax=b, where the matrix A is a lower triangular matrix and its dimension is very big (could be 10000 by 10000). Now I need to change a row of A and solve Ax=b again (this change will be many times). In order to speed up the calculation, a good approach is to calculate the inverse of matrix A and use the substitution to solve x. But when a row of matrix A is changed, I need to update the inverse of A. Is there a good idea to update the inverse of matrix A?</p>Bei Gouhttps://de.mathworks.com/matlabcentral/profile/authors/9156837-bei-goutag:de.mathworks.com,2005:Question/3323252017-03-28T13:08:54Z2017-03-28T13:08:54ZHow to use mat2cell in splitapply?<p>Hi,</p><p>I used findgroup and get a G as the output.
I would like to apply G to a numeric matrix (MxN) to split the matrix into several cells such that, each cell contains a smaller sized matrix (mxN).</p><p>How to write the code?
I tried this but got error: Not enough input arguments.
out = splitapply(mat2cell, mat, [1, 1], G);
Thanks.</p>JFzhttps://de.mathworks.com/matlabcentral/profile/authors/6201072-jfztag:de.mathworks.com,2005:Question/3305742017-03-18T18:42:16Z2017-03-28T13:05:48ZHow do I plot the nearest neighbour algorithm in a matrix?<p>Hi,</p><p>X = [0 0 0 0 0; 0 0 1 0 0; 0 0 0 0 1]</p><p>I would like to produce a coloured grid that displays the matrix elements equal to one as red. Yellow for the elements at a neighbourhood of 8 connectivity to the non-zero elements and green for the elements further away from 1.</p><p>Should I be using brute force or knnsearch or is there a better/ faster way to go about it?</p><p>Thanks</p>Riah Wilkinsonhttps://de.mathworks.com/matlabcentral/profile/authors/7418631-riah-wilkinsontag:de.mathworks.com,2005:Question/3323242017-03-28T13:04:54Z2017-03-28T13:04:54ZHow to remove lattice pattern from an EM image?<p>Hi everyone,</p><p>I am processing electron microscopy (EM) image data-sets containing 2D crystals.</p><p>I want to use filtering technique to generate lattice-free patch image for the area that has 2D crystals. I have to remove lattice pattern only by keeping all other features. (I'm attaching an image as a sample reference)</p><p>Can someone please help me out how to do this using MATLAB?</p><img src = "/matlabcentral/answers/uploaded_files/73590/EM_1.jpg">Asad Ali Siyalhttps://de.mathworks.com/matlabcentral/profile/authors/7676786-asad-ali-siyaltag:de.mathworks.com,2005:Question/3320262017-03-26T19:39:47Z2017-03-28T13:03:08Zhi ı am a master student and I have a home work<p>I have A BİNARY PİCTURE AND I WANT TO CALCULATE İT'S MAXİMUM width and length.can you help me , its a urgent situation =(</p>hasan güneshttps://de.mathworks.com/matlabcentral/profile/authors/9989524-hasan-gunestag:de.mathworks.com,2005:Question/3323182017-03-28T12:23:03Z2017-03-28T12:54:18ZReverse y axis order<p>Hi. I have the following script (attached )b and the run that it opens can be found at this link.</p><p>https://drive.google.com/open?id=0B0wQbicZOF7xN1BXV1FKVVRCT2c</p><p>It works perfectly except I want to reverse the the y- axis. I have tried several things but no luck. The only way I found is to do it manually. Is there another way?</p>David du Preezhttps://de.mathworks.com/matlabcentral/profile/authors/7651225-david-du-preeztag:de.mathworks.com,2005:Question/3323232017-03-28T12:53:44Z2017-03-28T12:53:44ZHow would I plot several cocentric circles with Z-Values as bars?<p>I have a matrix with values of azimuth (0-360° in 30° steps) in column 1, inclination (0-45 in 5° steps) in column 2 with their corresponding values of interest in column 3.
I'd like to visualize the column 3 (in z-direction) as a function of column 1 and 2 in 10 cocentric circles either as a bar graph or rather as a 3D pie chart (concerning appearance).</p><p>Sample data:</p><pre class="language-matlab">data = [0 0 42; 0 5 1337; 0 10 13; 30 0 456; 30 5 75; 30 10 4]
</pre><p>It then should look something like the polarhistogram, but with values in z-direction and input values not in polar coordinates:</p><img src = "https://ch.mathworks.com/help/examples/graphics/win64/CreateHistogramChartInPolarCoordinatesExample_01.png">rushorschhttps://de.mathworks.com/matlabcentral/profile/authors/7042925-rushorschtag:de.mathworks.com,2005:Question/3322152017-03-27T22:05:04Z2017-03-28T12:53:30ZHow do I set a custom algebraic upper/lower bound on lsqcurvefit, instead of a constant one?<p>How do I set a custom algebraic upper/lower limit on lsqcurvefit, instead of a constant one?
On lsqcurvefit, I can only specify a constant value as upper/lower bound, but I want to set an algebraic expression, such as (y ~ b0*x1+b1*x2) where b0+b1<1</p>Samuel Castrohttps://de.mathworks.com/matlabcentral/profile/authors/8343098-samuel-castrotag:de.mathworks.com,2005:Question/3322392017-03-28T02:50:56Z2017-03-28T12:51:27ZFinding the optimal minimum of two vectors<p>I have two vectors (97x1) where each element is a standard deviation of a range of data from a larger vector (145x1). I want to find where the optimal solution is to minimize both standard deviations (so not the absolute minimum of each vector individually). I tried looking at some of the optimization tools but couldn't figure out how to apply them to this problem... Any help would be appreciated but please be specific since I am not an experienced programmer.</p>Aaron Morrisonhttps://de.mathworks.com/matlabcentral/profile/authors/9557756-aaron-morrisontag:de.mathworks.com,2005:Question/3295802017-03-13T13:18:18Z2017-03-28T12:48:32ZPhysically correct Normalization of fft + Implementing Parseval's Theorem<p>Hi.
I've read endless amounts of similar stated questions on this forum, but I can't seem to find the answer to my specific question.</p><p>I would like to tranform a timesignal recorded by an accelerometer into the frequency domain. The accellerometer measured the acceleration of a hammer during impact with a floor. The Idea is to use the acceleration to calculate the force of the impact and then use the results to perform a FEM modelling of a floor. To save computation time in the FEM-model I wish to do the calculations in the frequency domain, since I'm not interested in the transient. Now, my question is as follows:</p><p>How should I scale the frequency amplitudes resulting from the fft, to get physically correct amplitudes in the frequency domain? After searching the forum and elsewhere for days I've come up with the following script:</p><pre class="language-matlab">%FFT
[x,Fs] = audioread('acceleration-file.WAV'); %x = Signal, Fs = samplingfrequency
T=1/Fs; %Sample period
L=length(x); %Signal length
df=2*Fs/L;
% FFT
NFFT=2^nextpow2(L);
Y = fft(x,NFFT)*T; %FFT of signal--> Will the multiplication with T result in a physically correct amplitude?
Ya = abs(Y); % Normalization of amplitude
f = Fs/2*linspace(0,1,L/2+1); %Frequency vector, only positive frequencies
YA= 2*Ya(1:L/2+1); %Frequency amplitudes, times two for one-sided spectrum
YA(1)=YA(1)/2; %Correction for the fact that DC doesn't occur twice
%Plot one-sided amplitude spectrum
figure
plot(f,YA)
title('Onesided amplitude spectrum')
xlabel('Frequency [Hz]')
ylabel('|y(t)|')
grid on
%Checking Parseval's Theorem
energy_x=sum(x.*conj(x)*T);
energy_YA=sum(YA.*conj(YA)*df);
diff=energy_x-energy_YA %Doesn't return 0.
</pre><p>Is this normalization correct? Also, is the implementation of Parseval's Theorem correct? To be clear, it's the following lines I'm really curious about(since parseval's theorem doesn't seem to hold):</p><pre class="language-matlab">%Normalizing amplitudes
Y = fft(x,NFFT)*T;
%Checking Parseval's Theorem
energy_x=sum(x.*conj(x)*T);
energy_YA=sum(YA.*conj(YA)*df);
diff=energy_x-energy_YA
</pre><p>Any help would be greatly appreciated, as satisfactory explanations are hard to come by out there.</p>Fiberglassboardhttps://de.mathworks.com/matlabcentral/profile/authors/3636013-fiberglassboardtag:de.mathworks.com,2005:Question/3323222017-03-28T12:46:27Z2017-03-28T12:47:12Zhello I'm a student , I need a Project speech recognition,system with hidden Markov models, Or neural networks,my project is Speech recognition , please if it is possible send me your working on speech recognition project using MATLAB.. i have some p<p>hello I'm a student , I need a Project speech recognition,system with hidden Markov models, Or neural networks,my project is Speech recognition , please if it is possible send me your working on speech recognition project using MATLAB.. i have some problem how to transform voice in matrice what's is steps for doing that (how to doing that) I record a word (in wav format) and I imported into my work space and I want to convert this file to matrix form? do know how to do that? tank you [removed email address] What I have tried: i have some problem how to transform voice in matrice what's is steps for doing that (how to doing that)</p>abdo wisshttps://de.mathworks.com/matlabcentral/profile/authors/8333500-abdo-wisstag:de.mathworks.com,2005:Question/2719122016-03-07T13:51:09Z2017-03-28T12:46:40ZRotate ylabel and keep centered<p>Hi,</p><p>Is there anyway to rotate the ylabel on a plot and ensure that the label is still centered on the axis?</p><p>Using</p><pre class="language-matlab">set(get(gca,'YLabel'),'Rotation',0)
</pre><p>I find that the label is 'shifted up' the y-axis after rotation.</p><p>Any help would be great.</p><p>Thanks.</p>pxg882https://de.mathworks.com/matlabcentral/profile/authors/3793236-pxg882tag:de.mathworks.com,2005:Question/3310182017-03-21T09:11:07Z2017-03-28T12:46:07ZUpdat GUI plot with new data<p>Dear all,</p><p>I have created a GUI that needs to update once a second in such a way that we see a moving wave.
My code is triggerd by a Timer:</p><pre class="language-matlab">ind1 =obj.plot_Timestamp(1,1); % left boundary plot
</pre><pre class="language-matlab">ind2 =obj.plot_Timestamp(1,2); % right boundary plot
</pre><pre class="language-matlab">axes(obj.handle_GUI_1); %get acces to my GUI for ploting
</pre><pre class="language-matlab">plot(obj.x,obj.y1,'--r',obj.x,obj.y2,'b'); %plot a calculated wave and a forecasted wave
</pre><pre class="language-matlab">title('Wave Elevation [m]');
</pre><pre class="language-matlab">xlabel('Time [s]');
</pre><pre class="language-matlab">xlim([ind1 ind2]); % my left and right boundary to be shown in my plot changing every sec.
</pre><pre class="language-matlab">ylim([-2 2]);
</pre><pre class="language-matlab">legend('RAO','HSC');
</pre><pre class="language-matlab">drawnow;
</pre><p>When I start the simulation, the plot is created in my GUI but instead of updating my GUI it starts ploting in a new figure after the first update ( so after 1 sec I get a new figure with my moving wave opened on top of my GUI).</p><p>I have tried several things but nothing seems to help.</p><p>Anyone an idea how to fix this?</p><p>Thx in advanced</p><p>stijn</p>Stijn Hilleniushttps://de.mathworks.com/matlabcentral/profile/authors/9819586-stijn-hilleniustag:de.mathworks.com,2005:Question/3322062017-03-27T20:52:07Z2017-03-28T12:43:26ZCan a two parameter Weibull Distribution be written as an exponential family form?<p>Hi guys, I was wondering whether the two parameter Weibull Distribution belongs to a exponential family?</p>Keqiao Lihttps://de.mathworks.com/matlabcentral/profile/authors/5396151-keqiao-litag:de.mathworks.com,2005:Question/3323212017-03-28T12:43:25Z2017-03-28T13:03:37ZReading BSB .KAP files<p>Hello,
I am currently developing a gui for an autonomous sea vehicle and would like to have a map interface to display waypoints. There will be no internet connection out on the boat (otherwise I would use the google maps interface) so I must access the maps from an offline state in addition to the whole GUI to be independently deployable. In order to achieve this I need to be able to read .KAP extension files to have the properly oriented maps. Am I going to be forced to use some type of conversion to .JPG with C or another program (where I will have to independently establish the map border coordinates) or can I directly access these file types from Matlab? I do not have the mapping toolbox. Any help would be appreciated,
Thanks,
Benjamin</p>Benjamin Welchhttps://de.mathworks.com/matlabcentral/profile/authors/6342697-benjamin-welchtag:de.mathworks.com,2005:Question/3323202017-03-28T12:40:29Z2017-03-28T12:40:29ZNN Toolbox: What is the difference between "performance" and "plotperform"?<p>So running the following code:</p><pre class="language-matlab">[x, t] = bodyfat_dataset;
net = feedforwardnet(10);
net.performParam.regularization = 0.01;
net = train(net, x, t);
y = net(x);
perf = perform(net, t, y)
</pre><p>Produces an output for perf, and then i can also view the performance through the nntraintool as a plot.</p><p>What is the difference between these two measures of performance?</p>Chris Hollandshttps://de.mathworks.com/matlabcentral/profile/authors/9697377-chris-hollandstag:de.mathworks.com,2005:Question/3322812017-03-28T09:09:01Z2017-03-28T12:39:45ZPlotting frequency spectrum of a signal<p>Hi, I wrote this code to obtain plot of frequency spectrum of my signals:</p><pre class="language-matlab">clc; clear all; close all;
</pre><pre class="language-matlab">%% Reading & plotting normal.wav file
normal = audioread('normal.wav');
figure(1)
plot(normal);
xlabel('Number of data','fontsize',12,'fontweight','b');
ylabel('Amplitude','fontsize',12,'fontweight','b');
title('Normal Heart Sound Signal','fontsize',14,'fontweight','b');
</pre><pre class="language-matlab">%% Reading & plotting murmur.wav file
murmur = audioread('murmur.wav');
figure(2)
plot(murmur);
xlabel('Number of data','fontsize',12,'fontweight','b');
ylabel('Amplitude','fontsize',12,'fontweight','b');
title('Murmur Heart Sound Signal','fontsize',14,'fontweight','b');
</pre><pre class="language-matlab">%% Fourier transform
fft_nor = fft(normal);
fft_mur = fft(murmur);
</pre><pre class="language-matlab">%% Calculating fs
% fs_normal
t_nor = 6; % s
N_nor = length(normal);
fs_nor = N_nor / t_nor; % Hz
% fs_murmur
t_mur = 8; % s
N_mur = length(murmur);
fs_mur = N_mur / t_mur; % Hz
</pre><pre class="language-matlab">%% Calculate the frequency axis
f_nor = fs_nor / 2 * linspace(-1,1,fs_nor);
f_mur = fs_mur / 2 * linspace(-1,1,fs_mur);
</pre><pre class="language-matlab">%% Plotting frequency spectrum
% Normal sound
figure(3)
plot(f_nor, abs(fft_nor));
xlabel('Frequency (Hz)','fontsize',12,'fontweight','b');
ylabel('Magnitude','fontsize',12,'fontweight','b');
title('Magnitude FFT Of Normal Signal','fontsize',14,'fontweight','b');
% Murmur sound
figure(4)
plot(f_mur, abs(fft_mur));
xlabel('Frequency (Hz)','fontsize',12,'fontweight','b');
ylabel('Magnitude','fontsize',12,'fontweight','b');
title('Magnitude FFT Of Murmur Signal','fontsize',14,'fontweight','b');
</pre><p>but after running it I have this error:</p><p>Error using plot
Vectors must be the same lengths.</p><p>Error in Q5b (line 40)
plot(f_nor, abs(fft_nor));</p><p>would anyone help me to fix it?</p>Ghazal Hnrhttps://de.mathworks.com/matlabcentral/profile/authors/9800962-ghazal-hnrtag:de.mathworks.com,2005:Question/3322742017-03-28T08:44:03Z2017-03-28T12:22:40Zcan we set beside each one bar graph another comparative?<p>Hi dear mathfriends, i need some help in order to set one bar graph, next to another one for make possible the comparisson between generation and comsumption, can you check it my code and give me some help to improve the attached graph?
This is the code:</p><p>% % Salidas de datos
mes={'Ene' 'Feb' 'Mar' 'Abr' 'May' 'Jun' 'Jul' 'Ago' 'Sep' 'Oct' 'Nov' 'Dic'};</p><p>%SALIDAS GRAFICAS</p><p>figure(1)</p><p>grid on</p><p>hold on</p><p>% title('Maximum Photovoltaic Power Harvesting');</p><p>xlabel('Meses [2015]');</p><p>ylabel('Energía [W·h]');</p><p>xlim([1 365]);</p><p>ax = gca;</p><p>ax.XTick = [1:30.4:365];</p><p>set(gca,'XTickLabel',mes);</p><p>ylim([0 Inf]);</p><p>% legend('Potencia Generable', 'Consumo');</p><p>% Y=[Pmax, CMUD1];</p><p>bar (Pmax, 'green');</p><p>hold on</p><p>bar (CMUD1, 'white');</p><p>% bar(Y);</p>Tony Castillohttps://de.mathworks.com/matlabcentral/profile/authors/5957553-tony-castillotag:de.mathworks.com,2005:Question/3287282017-03-08T11:14:22Z2017-03-28T12:22:26ZHow to load text file without header, programmatically specifying names of variables?<p>I have a directory of (space-delimited) text files, each of which contain meteorological data for a year. The file name has the form AAA_BBB_YYYY.txt. There are no headers in the .txt files - instead this information is given in a README file.</p><p>I would like to load all the files using a loop. The data should be stored as separate column vectors, or a structure of column vectors (or if there's a better way, I'm open to suggestions). The main concern is that I want to be able to specify the year that the data represents, and the name of the variables (e.g. location_1977_temperature, met.location.y1977.temperature). I envisage doing this using strings e.g.</p><pre class="language-matlab">>> loc='mlo';
>> year='y1977';
>> data=[1;2;3];
>> met.(loc).(year).temp = data
</pre><pre class="language-matlab">met =
</pre><pre> mlo: [1x1 struct]</pre><pre class="language-matlab">>> met.mlo.y1977.temp
</pre><pre class="language-matlab">ans =
</pre><pre> 1
2
3</pre><p>So the question is how can I achieve the above when I load the data file?</p><p>I've generated a function using the data import tool, but this uses (something like a) string literal to assign the variable names e.g.</p><pre class="language-matlab">%% Allocate imported array to column variable names
metmonth = dataArray{:, 2};
</pre><p>I suppose I could do something like</p><pre class="language-matlab">year='1977';data='month';loc='mlo';
met.(loc).(year).(data)=dataArray{: 2};
</pre><p>Is this the recommended way to achieve what I'm trying to do (i.e. I have to use a structure)?</p>Gerard Capeshttps://de.mathworks.com/matlabcentral/profile/authors/6789131-gerard-capestag:de.mathworks.com,2005:Question/3321322017-03-27T13:07:00Z2017-03-28T12:10:49ZHow can I design a cascaded IIR bandpass butterworth filter for my data x?<p>I have data with the intention to filter them offline. I would like to apply a cascaded IIR bandpass butterworth filter. I have a Fs of 5000 and would like to filter low pass (12 Hz) and high pass (10 Hz), order is 3. If I am correct, I have to use the sosfilt function?
My current code is:</p><p>[c,b,a] = butter(3,[0.004 0.0048]/(5000/2), 'bandpass');</p><p>sosbp = zp2sos(c,b,a)</p><p>x_filter = sosfilt(sosbp, x);</p><p>However, something is wrong since data are not filtered to the desired cut-off frequencies? Can anyone provide help?</p>Patrick Wiegelhttps://de.mathworks.com/matlabcentral/profile/authors/10029116-patrick-wiegeltag:de.mathworks.com,2005:Question/3321982017-03-27T19:55:39Z2017-03-28T12:08:23ZHow I connect more legends?<p>If I create a plot and then I connect 2 or more plots from different scripts. I want to have legends there about all plots. How I connect legends from more scripts?
Thank you</p>Dominikahttps://de.mathworks.com/matlabcentral/profile/authors/6324639-dominikatag:de.mathworks.com,2005:Question/3319262017-03-25T23:34:15Z2017-03-28T12:08:41ZRetrieve column vectors from table with correspondent names?<p>Hi!
I have this table (see image) from which I need to retrieve the individual columns and transform them into new variables - in the form of column vectors, and still easily recognizable by the column name. For example, retrieve the Fe column into a variable named e.g. Fe, and the Ni column into a variable named e.g. Ni, as I need to be able to investigate the relations between different chemical elements, i.e. different columns.</p><p>Is there an efficient way to do this almost automatically? This is because I need to deal with tables where the VariableNames can be different or appear in a different order within the table. Any help is appreciated!</p><img src = "/matlabcentral/answers/uploaded_files/73383/elemtable.png">Ana Castanheirohttps://de.mathworks.com/matlabcentral/profile/authors/7192086-ana-castanheirotag:de.mathworks.com,2005:Question/3322362017-03-28T02:14:53Z2017-03-28T12:07:38ZHow do I resolve the error "Invalid property: 'Exposure'." when defining webcam properties?<p>How do I resolve this error when I run my script? The commands al work fine when entered directly into the command window however once the script is run I get the following error every time when defining the exposure.</p><p>This is the full error message received:</p><pre class="language-matlab">Error using imaqdevice/subsasgn (line 33)
Invalid property: 'Exposure'.
Type 'imaqhelp' for information.
</pre><pre class="language-matlab">Error in DataCaptureCodev2 (line 32)
vid1.Exposure = -8;
</pre><p>The following code is the relevant code before the 'vid1.Exposure = -8' command:</p><pre class="language-matlab">vid1 = videoinput('winvideo','2','YUY2_640x480');
</pre><pre class="language-matlab">vid2 = videoinput('winvideo','3','YUY2_640x480');
</pre><pre class="language-matlab">set(vid1, 'FramesPerTrigger', Inf);
</pre><pre class="language-matlab">set(vid1, 'ReturnedColorspace', 'rgb');
</pre><pre class="language-matlab">set(vid2, 'FramesPerTrigger', Inf);
</pre><pre class="language-matlab">set(vid2, 'ReturnedColorspace', 'rgb');
</pre><pre class="language-matlab">vid1.FrameGrabInterval = 1;
</pre><pre class="language-matlab">vid2.FrameGrabInterval = 1;
</pre><p>Any advice will be greatly appreciated, thank you!</p>Fiona Gartlandhttps://de.mathworks.com/matlabcentral/profile/authors/7396028-fiona-gartlandtag:de.mathworks.com,2005:Question/558552012-12-06T03:54:21Z2017-03-28T12:03:48ZHow do I call a plot from a function in a GUI?<p>Hi! I created a function that plots 3 different signals and an average of all the signals onto the same plot. This function works fine when I call it with an m file, but if I call it using my GUI I cannot get the plot to show up on my axes in the GUI. I must use the same function I created to run with my m file to be called with my GUI. Below is my function (noisysignals) and my GUI code.</p><p>Thanks!</p><p>MY FUNCTION</p><pre class="language-matlab">function noisysignals(a,b,c,d,e,g)
SR=500;
time=400./1000;
</pre><pre class="language-matlab">G=g/1000;
</pre><pre class="language-matlab">NumberofPoints=time.*SR;
increment=time./NumberofPoints;
t=0:increment:time;
</pre><pre class="language-matlab">x=b.*(t.^e).*exp(-t./G).*cos(2.*pi.*c.*t);
</pre><pre class="language-matlab">noise=rand(a,length(x)).*d;
copies=repmat(x,[a 1]);
</pre><pre class="language-matlab">copieswithnoise = copies+noise;
Average= mean(copieswithnoise);
</pre><pre class="language-matlab">hold on
line1 =plot (t,copieswithnoise (1,:), 'b', 'Linewidth', 1));
line2=plot (t,copieswithnoise (2,:), 'b', 'Linewidth', 1);
line3=plot (t,copieswithnoise (3,:), 'b', 'Linewidth', 1);
line4=plot ( t, Average, 'r', 'LineWidth', 3 );
hold off
</pre><pre class="language-matlab">title ('Signals With Noise','FontSize', 17);
xlabel ('Time (seconds)','FontSize', 12);
ylabel ('Voltage (Volts)','FontSize', 12);
</pre><pre class="language-matlab">legendHandle = [line1 line2 line3 line4];
legend(legendHandle([1 4]),'Individual Signals','Average of all Signals');
</pre><pre class="language-matlab">end
</pre><p>MY GUI (The important part- I skipped over defining each of my edit boxes)</p><pre class="language-matlab">--- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
hObject handle to pushbutton1 (see GCBO)
eventdata reserved - to be defined in a future version of MATLAB
handles structure with handles and user data (see GUIDATA)
</pre><pre class="language-matlab">N= str2double(get(handles.copies, 'string'));
amplitude= str2double( get(handles.Amplitude, 'string'));
frequency= str2double(get(handles.Frequency, 'string'));
gamma= str2double(get(handles.Gamma, 'string'));
tau= str2double(get(handles.Tau, 'string'));
standardD= str2double(get(handles.SD, 'string'));
</pre><pre class="language-matlab">noisysignals (N, amplitude, frequency, standardD, gamma, tau);
</pre>Stephaniehttps://de.mathworks.com/matlabcentral/profile/authors/3905878-stephanietag:de.mathworks.com,2005:Question/134682011-08-10T14:49:40Z2017-03-28T12:02:36ZType 2 fuzzy logic System<p>where can I find the "interval type 2 fuzzy logic system" IT2FLS toolboxs.</p><p>i need to download it & start using it in my matlab the same way i use the Fuzzy logic toolbox which comes with matlab</p><p>Thanx in advance ...</p>Twilighterhttps://de.mathworks.com/matlabcentral/profile/authors/2591832-twilightertag:de.mathworks.com,2005:Question/3321862017-03-27T18:33:14Z2017-03-28T12:01:43ZHow do I make the mouse cursor move at a custom rotation angle?<p>I want to make the mouse cursor move at a custom rotated angle. The idea is to input the angle of rotation form the user, then apply the rotation to the original path of the mouse cursor movement. Any help would be appreciated.</p>Shikhar Vatshttps://de.mathworks.com/matlabcentral/profile/authors/9452103-shikhar-vatstag:de.mathworks.com,2005:Question/3092622016-10-26T13:09:19Z2017-03-28T12:01:12ZHow can I keep figures invisible when going between different figures and different subplots?<p>Hi
I have a script with three figures (f1, f2, and f3) that are invisible to the user, each with four subplots (sp1, sp2, sp3 and sp4). I need to call these figures at various times in the script to plot data. E.g., I first plot on f1-sp1, then on f2-sp1, and f3-sp1. In the next iteration of the loop I plot on f1=sp2, f2-sp2, f3-sp2, etc... Is anyone please able to tell me how to do this without making the figures visible?
For each figure I can assign handles to the subplots with the following code,</p><pre class="language-matlab">for sp=1:4
ax(sp)=subplot(2,2,sp);
end
</pre><p>and then with the current figure I can move around the subplots using</p><pre class="language-matlab">subplot(ax(2))
</pre><p>I can do this for each figure, i.e., end up with ax1, ax2 and ax3, but using these in the codes only seems to move within the current figure. E.g.,</p><pre class="language-matlab">subplot(ax2(4))
</pre><p>will make subplot 4 of the current figure active, but will not necessarily make subplot 4 of figure 2 active. If I make figure 2 current using</p><pre class="language-matlab">figure(2)
</pre><p>then it becomes visible.</p><p>Can anyone help me with how to make a specific subplot of a specific figure current, without making the figure visible?</p><p>Thanks very much
Jen</p>Jennifer Davieshttps://de.mathworks.com/matlabcentral/profile/authors/6539607-jennifer-daviestag:de.mathworks.com,2005:Question/3323172017-03-28T11:47:22Z2017-03-28T11:49:48Zhow do i write a function file that takes as input a matrix A <p>the function file should be abled to be tests whether or not the matrix is(a) square, and (b)diagonally dominant, reporting the answers on screen show that your code is correct by testing it for the matrix:
2x-x+3x=8
4x+2x-5x=-9
6x+3x+x=12</p><p>10x+x+2+3
x+10x-x=1.5
2x+X+110x=-9
,as well as for cases where the matrix is not diagonally dominant, and not square.</p>thokozile hermanshttps://de.mathworks.com/matlabcentral/profile/authors/9631877-thokozile-hermanstag:de.mathworks.com,2005:Question/3322692017-03-28T08:15:15Z2017-03-28T11:51:46ZHow do I swap the dimensions of a 3D matrix?<p>For example, I have a 3D array A so that size(A) = [5, 2, 20];
How could I make it like [20, 2, 5] or [2, 5, 20], any order?</p><p>Edit: I didn't make it clear initially. A is 3-D, like a dice, I don't want to cut the dice and rearrange the data, instead I just want to roll the dice, so that I'm looking at this same dice just from a different angle.</p>Brucedai003https://de.mathworks.com/matlabcentral/profile/authors/10017497-brucedai003tag:de.mathworks.com,2005:Question/3322832017-03-28T09:09:46Z2017-03-28T11:44:56ZTransforming an image back to its original state<p>I have several images and I would like to transform them from:</p><img src = "/matlabcentral/answers/uploaded_files/73588/2.png"><p>or</p><img src = "/matlabcentral/answers/uploaded_files/73591/3.png"><p>back to the original image:</p><img src = "/matlabcentral/answers/uploaded_files/73592/1.png"><p>Can you please suggest a method to perform such operation.
At the moment I'm using the below code which doesn't help much.</p><pre> function transform()
I = imread ('pic1.png');
tform = maketform('affine',[2 0.7 0; .1 4 0; 3 8 1]);
J = imtransform(I,tform);
imshow(I), figure, imshow(J)
end</pre>Jason Earlyhttps://de.mathworks.com/matlabcentral/profile/authors/7002978-jason-early