https://in.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-09-19T11:29:54Ztag:in.mathworks.com,2005:Question/3573272017-09-19T08:50:26Z2017-09-19T11:28:52ZFast dot product in three dimensions<p>Dear community
I am trying to speed up my code, and the bottleneck is the following operation.</p><pre class="language-matlab">A=rand(3,3,3);
B=rand(3,1);
tic
for i=1:1000000
C=B(1).*A(:,:,1)+B(2).*A(:,:,2)+B(3).*A(:,:,3);
end
toc
</pre><p>I wrote 1000000, but it can be much more. Anyone getting a faster solution? Another way I found to avoid to repeat A, but is slower since it involves reshape and 3D multiplications is</p><pre class="language-matlab">sum(bsxfun(@times,A,reshape(B,[1 1 3])),3);
</pre><p>Thank you in advance</p><p>Florian
Matlab R2017a</p>Florianhttps://in.mathworks.com/matlabcentral/profile/authors/6663804-floriantag:in.mathworks.com,2005:Question/3573492017-09-19T10:21:11Z2017-09-19T11:28:43ZRemove zeros from all columns of a 3d matrix<p>A matrix named 'T' is attached whose dimension is 3,3048, 1849.</p><p>I want to remove all the zeros from columns (3048).</p><p>can anyone help me.</p>Arvind Kumar Pathakhttps://in.mathworks.com/matlabcentral/profile/authors/10009741-arvind-kumar-pathaktag:in.mathworks.com,2005:Question/3572352017-09-18T19:29:05Z2017-09-19T11:27:20ZMinimizing a function with discrete variables<p>Hi,</p><p>How can I minimize the sum f(x1,x2) = x1+x2 where both x1 and x2 are discrete and can only assume values from a set of pre-defined values?</p><p>Thank you for the help</p>Koel Sinhahttps://in.mathworks.com/matlabcentral/profile/authors/6817736-koel-sinhatag:in.mathworks.com,2005:Question/3333712017-04-03T14:26:05Z2017-09-19T11:27:15Z generate a folder and <p>fff</p>diana sandrahttps://in.mathworks.com/matlabcentral/profile/authors/1815792-diana-sandratag:in.mathworks.com,2005:Question/3570602017-09-17T14:31:17Z2017-09-19T11:26:49Zfinding min max in matrix with loops and condintion only<p>hi, its me again, got an exam next week.
I need to find the ma number and min number and then print them,this what I comefore please help me with sintaxx and right writing</p><pre class="language-matlab">n=randi(6);
a=randi(100,n,n);
b=a(1,1);
for i=1:n
{
for j=1:n
{
if a(i,j)<=a(1,1);
b=a(i,j);
end
}
};
fprintf('min num is x=%d/n',b);
</pre>yuval ohayonhttps://in.mathworks.com/matlabcentral/profile/authors/10651585-yuval-ohayontag:in.mathworks.com,2005:Question/3568092017-09-15T06:44:35Z2017-09-19T11:23:12ZHow can I run Specific M-Script in each timestep of SIMULINK Model Simulation.<p>I tried to use MATLAB Function block, but its shows code generation error in simulation.</p>Purusothaman Ganapathyhttps://in.mathworks.com/matlabcentral/profile/authors/4348869-purusothaman-ganapathytag:in.mathworks.com,2005:Question/2844402016-05-16T14:50:50Z2017-09-19T11:23:10ZHow to change Simulink model line widths<p>Hi,</p><p>I would like to change the line width of the wires in the simulink environment.</p><p>I mean if I want to make the line thicker marked in red in the picture. So that model can be added to publish in better view.</p><p>Thanks</p><img src = "/matlabcentral/answers/uploaded_files/52415/simulink_linwidth.JPG">Safiyahttps://in.mathworks.com/matlabcentral/profile/authors/117473-safiyatag:in.mathworks.com,2005:Question/3541802017-08-27T06:25:44Z2017-09-19T11:18:21ZHow to add leading zero to a letter in matlab<p>I have written a code which will accepts a sequence and convert it to specific numerical sequence. The code is given below--</p><pre class="language-matlab">if true
% code
end
function[xA]=dnatobinary(sample_dna)
for i=1:length(sample_dna)
if sample_dna(i)=='A'|| sample_dna='a'
xA(i)=01;
elseif sample_dna(i)=='T' || sample_dna='t'
xA(i)=11;
end
end
end
</pre><p>Now this code should convert 'ATTTA' into '0111111101'. Instead it is converting it as '11111111' i.e the leading zero for A=01 is missing.please provide appropriate coding.</p>SUBHAJIT KARhttps://in.mathworks.com/matlabcentral/profile/authors/10716603-subhajit-kartag:in.mathworks.com,2005:Question/1547142014-09-14T09:57:02Z2017-09-19T11:17:55Zhow can I convert 2d images to a 3d image?<p>I have a CT scan file with 51 slices...how can I make a 3d image with this 51 slices?</p><p>Is there any toolbox in matlab for this?</p><p>I attached this file.</p>sarahttps://in.mathworks.com/matlabcentral/profile/authors/5590407-saratag:in.mathworks.com,2005:Question/3573462017-09-19T10:07:09Z2017-09-19T11:13:58Zlinear solve with sparse distributed arrays<p>Hi,
in this 2015 question ( <a href = "https://es.mathworks.com/matlabcentral/answers/184001-parallel-coding-how-to-solve-linear-system">link</a> ) it states that distributed arrays do not work for SPARSE systems.
Is it still the case?
Thanks</p>Sergio Zlotnikhttps://in.mathworks.com/matlabcentral/profile/authors/447426-sergio-zlotniktag:in.mathworks.com,2005:Question/3573582017-09-19T11:10:12Z2017-09-19T11:29:54ZIndex exceeds matrix dimensions<p>I am having an issue with the index exceeds matrix dimensions which for the life of me I can't understand because this is very similar (almost identical) to a piece of code I have previously written for the same assignment task which worked perfectly only the data has been scaled up to be metres as opposed to millimetres.</p><p>The data for the dam depths is a 36 x 20 array</p><pre class="language-matlab">a = xlsread('C:\Users\Rhys\Desktop\Matlab assignment\Task 2\dam_data.xlsx')*-1; %load data and correct orrientation
</pre><pre> [X,Y] = meshgrid(1600:200:5400,2400:200:9400); %grid for measurement incrememnts (scaled 1:10000 and converted to m)</pre><pre> H_max = min(min(a)); %deepest point in dam</pre><pre> h_current = 16.2; %current dam water level</pre><pre> b = a<0; %determine points below dam wall height</pre><pre> c = a.*b; %correcting data to show points only below dam wall height</pre><pre> e = 0;</pre><pre> for i = 1 : X - 1 %determine to scale capacity</pre><pre> e = e + (-c(i+1) + -c(i))/4 * (X(i+1)-X(i));</pre><pre> for j = 1 : Y - 1</pre><pre> e = e + (-c(j+1) + -c(j))/4 * (Y(j+1)-Y(j));</pre><pre> end
end</pre><p>the offending line of code is which continues in a loop until it gets to 720 iterations then stops is</p><pre class="language-matlab">for j = 1 : Y - 1
</pre><pre> e = e + (-c(j+1) + -c(j))/4 * (Y(j+1)-Y(j));</pre><pre> end</pre><p>The error message I get is</p><p>Index exceeds matrix dimensions.</p><p>Error in assignment_code (line 19)
e = e + (-c(j+1) + -c(j))/4 * (Y(j+1)-Y(j));</p><p>Any help with this would be appreciated as for the most part what I have learnt has been through google and I am really struggling with this one (I managed to fix by pure fluke last time I had this issue).</p>Rhys Webbhttps://in.mathworks.com/matlabcentral/profile/authors/11006704-rhys-webbtag:in.mathworks.com,2005:Question/3573572017-09-19T10:48:27Z2017-09-19T10:57:18ZData does not Acquire in main script from function<p>I am working on acquiring mouse cursor data on matlab. Function 'mouseMove' is create for this purpose. function is working very well and current mouse cursor data is also retrieve. but I want to acquire that cursor data on main script which is update as the mouse move. But problem is that mouse cursor data in variable 'data' which is calling the function , is not updating the values as the cursor move</p><p>This my main code/script.</p><pre> %% For single image
img = imread('pic.jpg'); %Read the image
imshow(img); % Show the image
temp = @mouseMove; % Create Function Handle
set (gcf, 'WindowButtonMotionFcn', temp); % Data map on plot figure
data = temp() % Acquire the mouse cursor data</pre><p>this my function</p><pre class="language-matlab">function result = mouseMove (object, eventdata)
result = get (gca, 'CurrentPoint');
title(gca, ['(X,Y) = (', num2str(result(1,1)), ', ',num2str(result(1,2)), ')']);
end
</pre>Abdul Basit Jaweedhttps://in.mathworks.com/matlabcentral/profile/authors/8083823-abdul-basit-jaweedtag:in.mathworks.com,2005:Question/3573512017-09-19T10:25:29Z2017-09-19T10:45:13Zhow can I write a program that take input(only 2 digit numbers) from the user and prints the division of 1st with respect 2nd.The program must repeat using while loop until both the digits entered are zero<pre class="language-matlab">a=input('enter the number','s')
while a>0
b=a(1)/a(2)
a=input('enter the number','s')
end
</pre><p>I think this program is little bit true.Please help</p>Shariq Nazirhttps://in.mathworks.com/matlabcentral/profile/authors/10480565-shariq-nazirtag:in.mathworks.com,2005:Question/3573542017-09-19T10:34:46Z2017-09-19T10:43:14ZWhy is MATLAB officially written with capitalized letters? <p>The name is short for "Matrix Laboratory", and I therefore find "MatLab" to be the logical choice of capitalizing.</p>Martinhttps://in.mathworks.com/matlabcentral/profile/authors/3656063-martintag:in.mathworks.com,2005:Question/3573562017-09-19T10:40:18Z2017-09-19T10:40:18Zhow to plot the fourier transform of a cosine like function<p>I have a function for autocovariance and i need to prove that the fourrier transform of it, is the spectrum of a signal. Also i am given another function that gives the spectrum at the specified circular frequency w0.</p><p>First i give you the script of the second function (which gives the desired result correctly)</p><pre class="language-matlab">clear
clc
close all
</pre><pre class="language-matlab">N = 10^6; %samples
t = 1:N; %time axis
t = t/N;
</pre><pre class="language-matlab">T = max(t); % T=1
M=1; % components
</pre><pre class="language-matlab">sigma = 1;
A= 10;
w0 = 10;
</pre><pre class="language-matlab">U = zeros(1,N);
U= 2*pi*rand(1,N);
</pre><pre class="language-matlab">B = zeros(1,N);
</pre><pre class="language-matlab">dt = T/N;
</pre><pre class="language-matlab">dW = zeros(1,N);
B = zeros(1,N);
</pre><pre class="language-matlab">dW(1) = sqrt(dt)*randn;
B(1) = dW(1);
for j = 2:N
dW(j) = sqrt(dt)*randn;
B(j) = B(j-1) + dW(j);
end
</pre><pre class="language-matlab">Noise = zeros(1,length(t));
Noise= A * cos(w0 * t + sigma * B + U );
</pre><pre class="language-matlab">w = linspace(0,20,N);
[S_N]=eq8spectrum(w,w0,N,A,sigma);
</pre><pre class="language-matlab">figure;
semilogy(w,S_N);
grid on
xlabel('circular frequency')
legend(' Α=10, sigma = 1 ');
title('Spectrum of N(t) equation 8');
</pre><p>The above code gives me the desired spectrum, and the maximum value close to circular frequency w0=10.</p><p>Now the problematic script.</p><pre class="language-matlab">clear
clc
</pre><pre class="language-matlab">N = 10^6; %samples
t = 1:N; %time axis
t = t/N;
</pre><pre class="language-matlab">T = max(t); % T=1
M=1; % components
</pre><pre class="language-matlab">sigma = 1;
A= 10;
w0 = 1
</pre><pre class="language-matlab">w = linspace(0,20,N);
</pre><pre class="language-matlab">KN = zeros(1,N) ; %total autocovariance
</pre><pre class="language-matlab">tmp1 = A^2/2;
tmp2 = cos(w0*t);
tmp3 = exp(( -1/2) * (sigma^2) * abs(t));
</pre><pre class="language-matlab">KN = tmp1 * tmp2 .* tmp3;
</pre><pre class="language-matlab">FFTKN = fft(KN);
FFTKN = abs(fft(KN));
</pre><pre class="language-matlab">figure;
semilogy(w,FFTKN);
title('fft of KN');
</pre><p>So the two plots are different (the last one is wrong). So what can i do for the second script?</p>vaggelis papasothttps://in.mathworks.com/matlabcentral/profile/authors/7636831-vaggelis-papasottag:in.mathworks.com,2005:Question/3573552017-09-19T10:38:22Z2017-09-19T10:38:22ZCan i get help in getting the similarity and differences of each of the plot first is in the frequency domain and second is in the time domain also if you can help me get the comments on each plots th<p><<</p><img src = "/matlabcentral/answers/uploaded_files/88412/freq1.PNG"><p>>></p><img src = "/matlabcentral/answers/uploaded_files/88413/time.PNG">Divyesh Patelhttps://in.mathworks.com/matlabcentral/profile/authors/11001982-divyesh-pateltag:in.mathworks.com,2005:Question/3573532017-09-19T10:32:53Z2017-09-19T10:34:01ZWorkaround to specify interrupt service routines to analyse multitasking with Polyspace<p>Workaround to specify interrupt service routines to analyse multitasking with Polyspace.
In our project we have interrupt service routines with parameters (RTEMS). Polyspace requires interrupts of the type: void function_name(void).
How can I match the requirement in the best way?
Thanks
Konrad</p>Konrad Mayerhttps://in.mathworks.com/matlabcentral/profile/authors/10813629-konrad-mayertag:in.mathworks.com,2005:Question/3573522017-09-19T10:32:01Z2017-09-19T10:32:01ZHow to extract this points location from SURFFeatures?<p>How to extract this points location from SURFFeatures?</p><img src = "/matlabcentral/answers/uploaded_files/88406/feature_img1.jpg">Selva Karnahttps://in.mathworks.com/matlabcentral/profile/authors/4733665-selva-karnatag:in.mathworks.com,2005:Question/3573502017-09-19T10:24:21Z2017-09-19T10:42:20ZReconstruct shifted values after training a dynamic neural network ?<p>I'm implementing a dynmaic neural network that has an input delay and also a feedback delay. After training and simulating my neural net I observed that the output has been shifted respectively with the number of steps of the my time delay. Is there a way to reconstruct the lost values?</p>Mohamed Amine Chaalebhttps://in.mathworks.com/matlabcentral/profile/authors/5830562-mohamed-amine-chaalebtag:in.mathworks.com,2005:Question/3571762017-09-18T12:55:22Z2017-09-19T10:23:11ZNonlinear fitting of a numerical solution of a PDE<p>I need to perform nonlinear fitting of a numerical solution of a PDE to experimental data, but I can't use the <tt>nlinfit</tt> function, since it requires an analytical expression, whereas I have a numerical solution of a PDE.
What kind of command should I use in this case for parameter estimation through nonlinear fitting?</p>matnewbiehttps://in.mathworks.com/matlabcentral/profile/authors/5913505-matnewbietag:in.mathworks.com,2005:Question/265502012-01-19T20:17:28Z2017-09-19T10:17:52ZProblem with Autocorr/ACF function<p>Hi All
I am a new MATLAB user, I am trying plot ACF functions for 12 lags, so basically I am using the following function:
[ACF, lags, bounds] = autocorr(U, [], 12)
bounds
0.0928
-0.0928
But i am getting an error message as follows</p><p>??? Undefined function or method 'autocorr' for input arguments of type 'double'.</p><p>Please provide some insight! Thank you so much!</p>maitreyi mandalhttps://in.mathworks.com/matlabcentral/profile/authors/3260021-maitreyi-mandaltag:in.mathworks.com,2005:Question/3567282017-09-14T16:38:14Z2017-09-19T10:17:27ZHow can i measure execution time or clock cycles utilized by a bloc simulink which will be run on FPGA" zedboard"? <p>I need to measure or estimate the number of clock cycle utilized by a bloc simulink runing on FPGA. I use HDL workflow to implement my bloc system on zedboard.</p>mouna riabihttps://in.mathworks.com/matlabcentral/profile/authors/4072659-mouna-riabitag:in.mathworks.com,2005:Question/3573482017-09-19T10:10:06Z2017-09-19T10:10:06ZHow to change the contents of an exported .mat file to an Excel file<p>Hi,</p><p>I wrote a code that converts two .mat files into Excel files from the selected selection of a list named Log. The code is as follows:</p><pre class="language-matlab">function Log_Callback(hObject, eventdata, handles)
g=get(handles.Log,'value')
if (g~=1)
x=get(handles.Log,'String');
y=get(handles.Log,'value');
f=x{y};
if(strcmp(f,'Exchange between FT0 and FT1 "Boolean"'))
set_param('MAJ','SimulationCommand','stop');
stop(handles.t);
set(handles.Stop,'BackgroundColor', 'red');
data=load('FT1Exchange(1).mat');
</pre><pre> h=fieldnames(data); </pre><pre> for k=1:size(h,1)
xlswrite('testFT1.xlsx',data.(h{k}),h{k})
end
winopen testFT1.xlsx
elseif(strcmp(f,'Exchange between FT0 and FT1 "Double"'))
set_param('MAJ','SimulationCommand','stop');
stop(handles.t);
set(handles.Stop,'BackgroundColor', 'red');
data=load('FT1Exchange(2).mat'); </pre><pre> h=fieldnames(data);
for k=1:size(h,1)
xlswrite('testFT11.xlsx',data.(h{k}),h{k})
end
winopen testFT11.xlsx
end;
end;</pre><p>ترجم!</p><p>J'ai deux questions:</p><p>1- Le code suivant permet de convertir les deux .mat dans deux fichiers Excel séparés, comment pourrai-je insérer les deux .mat dans deux feuilles du même fichier Excel?</p><p>2- Je reçois comme résultat le tableau suivant:</p><p>240/5000
I have two questions:</p><p>1- The following code converts both .mat into two separate Excel files, how can I insert both .mat into two sheets of the same Excel file?</p><p>2- I get as a result the following table:</p><img src = "/matlabcentral/answers/uploaded_files/88404/tab.PNG"><p>How can I add a column at the beginning that includes the name of each line?</p><p>Thank you for your Help</p>Samah EL QASSAHhttps://in.mathworks.com/matlabcentral/profile/authors/7829682-samah-el-qassahtag:in.mathworks.com,2005:Question/3573472017-09-19T10:09:45Z2017-09-19T10:09:45ZSummation in a for loop of a function<p>Hi everyone! I need to write a function for ode45 solver, but the results I'm getting are wrong. What i need to get is a system of ODEs. To do so i prepared something like this:</p><pre class="language-matlab">function dndt = fun(t,n)
</pre><pre class="language-matlab">global v
%v is defined in another file
dndt = zeros(numel(v),1);
for i = 1 : numel(v) - 1
dndt(i) = sum(n(i : numel(v))) * v(i+1) - v(i) * n(i);
end
</pre><pre class="language-matlab">end
</pre><p>Now, my question is: sum(n(i : numel(v))) should be the summation of n(k) with k going from i to number of intervals. Is it correct to write it like that? Or should I introduce another for loop to solve that summation? Thanks!</p>Erghttps://in.mathworks.com/matlabcentral/profile/authors/8516210-ergtag:in.mathworks.com,2005:Question/3573362017-09-19T09:35:23Z2017-09-19T10:30:35Zhow to identify the white circles and dark circles from an image<p>how to identify the white circles and dark circles from an image. The first image is input. The second one is i did complement and found the centroids of the circle. With positions remaining unchanged, how to find which positions contain circles are black and/or which are white.</p><img src = "/matlabcentral/answers/uploaded_files/88402/braille-alphabet-flashcard-h.jpg"><img src = "/matlabcentral/answers/uploaded_files/88403/Untitled.png">Elysi Cochinhttps://in.mathworks.com/matlabcentral/profile/authors/3625227-elysi-cochintag:in.mathworks.com,2005:Question/3573372017-09-19T09:36:08Z2017-09-19T10:04:47Z 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://in.mathworks.com/matlabcentral/profile/authors/10976076-eric-agyemangtag:in.mathworks.com,2005:Question/3406732017-05-17T12:54:35Z2017-09-19T10:04:15ZError using trainFasterRCNNObjectDetector<p>RCNN was working well i just change the function name to trainFasterRCNNObjectDetector and I have this error I dont understand as the algorithm success to traing the RPN ..</p><p>Error using vision.internal.cnn.fastrcnn.RegionReader (line 146)
Unable to find any region proposals to use as positive or negative training samples.</p><pre class="language-matlab">*** | | | | _ _**********************************************************************
Training a Faster R-CNN Object Detector for the following object classes:
</pre><pre class="language-matlab">* stem
</pre><pre class="language-matlab">Step 1 of 4: Training a Region Proposal Network (RPN).
|=========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning|
| | | (seconds) | Loss | Accuracy | Rate |
|=========================================================================================|
| 1 | 1 | 73.10 | 0.7613 | 57.81% | 1.00e-04 |
| 1 | 50 | 3588.44 | 0.8843 | 49.21% | 1.00e-04 |
| 2 | 100 | 7138.63 | 0.8157 | 49.21% | 1.00e-04 |
| 3 | 150 | 10567.96 | 0.5309 | 90.48% | 1.00e-04 |
| 3 | 200 | 13992.71 | 0.4853 | 93.75% | 1.00e-04 |
| 4 | 250 | 17495.29 | 0.4534 | 95.31% | 1.00e-04 |
| 5 | 300 | 20907.92 | 0.5276 | 81.25% | 1.00e-04 |
| 5 | 350 | 24321.68 | 0.4508 | 95.31% | 1.00e-04 |
| 6 | 400 | 27764.91 | 0.4548 | 96.88% | 1.00e-04 |
| 7 | 450 | 31263.06 | 0.3596 | 95.31% | 1.00e-04 |
| 7 | 500 | 34683.48 | 0.4480 | 96.88% | 1.00e-04 |
| 8 | 550 | 38116.15 | 0.4450 | 92.06% | 1.00e-04 |
| 9 | 600 | 41608.04 | 0.3407 | 96.88% | 1.00e-04 |
| 9 | 650 | 45094.22 | 0.4522 | 96.88% | 1.00e-04 |
| 10 | 700 | 48521.79 | 0.3036 | 98.44% | 1.00e-04 |
| 10 | 730 | 50591.95 | 0.3237 | 98.44% | 1.00e-04 |
|=========================================================================================|
</pre><pre class="language-matlab">Step 2 of 4: Training a Fast R-CNN Network using the RPN from step 1.
*******************************************************************
Training a Fast R-CNN Object Detector for the following object classes:
</pre><pre class="language-matlab">* stem
</pre><pre class="language-matlab">--> Extracting region proposals from 92 training images...done.
</pre><pre class="language-matlab">Error using vision.internal.cnn.fastrcnn.RegionReader (line 146)
Unable to find any region proposals to use as positive or negative training samples.
</pre><pre class="language-matlab">Error in vision.internal.cnn.fastrcnn.TrainingRegionDispatcher (line 63)
vision.internal.cnn.fastrcnn.RegionReader(...
</pre><pre class="language-matlab">Error in fastRCNNObjectDetector/createTrainingDispatcher (line 667)
dispatcher = vision.internal.cnn.fastrcnn.TrainingRegionDispatcher(...
</pre><pre class="language-matlab">Error in fastRCNNObjectDetector.train (line 173)
dispatcher = createTrainingDispatcher(...
</pre><pre class="language-matlab">Error in trainFasterRCNNObjectDetector (line 297)
[~, fastRCNN] = fastRCNNObjectDetector.train(trainingData, fastRCNN, options(2), params, checkpointSaver);
</pre><pre class="language-matlab">Error in mainFast (line 47)
rcnnFaster = trainFasterRCNNObjectDetector(wheatT, convnet, options, ...__||||
</pre>Simon MADEChttps://in.mathworks.com/matlabcentral/profile/authors/3897310-simon-madectag:in.mathworks.com,2005:Question/3573312017-09-19T09:10:48Z2017-09-19T10:02:55ZWithout using any matlab built-in program,how can I create a program that tells about the no of rows and column in a matrix<p>I think that this program can form by using for loop.Please help</p>Shariq Nazirhttps://in.mathworks.com/matlabcentral/profile/authors/10480565-shariq-nazirtag:in.mathworks.com,2005:Question/3570482017-09-17T10:58:43Z2017-09-19T10:01:16Zhow to renew matlab license?<p>whenever i open matlab i receive this message on command window " Your MATLAB license will expire in 55 days.
Please contact your system administrator or
The MathWorks to renew this license."
can you please help me how to renew this?</p>anam zahrahttps://in.mathworks.com/matlabcentral/profile/authors/9439488-anam-zahratag:in.mathworks.com,2005:Question/3481342017-07-11T02:55:39Z2017-09-19T09:53:19ZMATLAB 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://in.mathworks.com/matlabcentral/profile/authors/10398573-yeehang-kimtag:in.mathworks.com,2005:Question/3573412017-09-19T09:45:30Z2017-09-19T09:53:17ZHow to implement this algorithm?<p>I have a doubt in the above code. I want to declare x=x1,x2,x3..x8
But i got an error</p><pre class="language-matlab">clc;
clear all;
close all;
</pre><pre class="language-matlab">x=[0 1 1 0 1 1 0 1];
y=[0 0 0 0 0 0 0 0];
</pre><pre class="language-matlab">for j=1:8
x[j] = [xj:xj+1];
Yj = (xor(yj-1,xj)*H);
end
Y
</pre><p>The error was:
Undefined function or variable 'xj'.</p><p>Error in counter1 (line 9)
x=[xj:xj+1];</p><p>>> counter1
Error: File: counter1.m Line: 9 Column: 8
Unbalanced or unexpected parenthesis or bracket.</p>Darsana P Mhttps://in.mathworks.com/matlabcentral/profile/authors/9051001-darsana-p-mtag:in.mathworks.com,2005:Question/3573452017-09-19T09:53:09Z2017-09-19T09:54:22ZHow to recover variance from an Guassian kernel generated by using "fspacial" ?<p>Hello,</p><p>I have a Gaussian kernel generated by "fspecial" command, the code is below:</p><p>A=fspecial('gaussian',[5,5], 2);</p><p>From the above code I construct the Gaussian kernel with variance 2.</p><p>but now I want to do it in the reverse way:</p><p>Given a Gaussian kernel A, is it possible to recover the variance by using any methods or tricks?</p><p>Thank you in advance!</p>Gasper Hsiehhttps://in.mathworks.com/matlabcentral/profile/authors/7241580-gasper-hsiehtag:in.mathworks.com,2005:Question/3573302017-09-19T09:02:30Z2017-09-19T09:48:24ZEEG Signal pre-processing<p>I have a time domain EEG signal that I got from BCI competition III website. I want to bandpass(8-30 Hz) it using FIR and IIR filters. how should I chose the filter order and other specifications such as stop band attenuation etc. how can I design such a filter in Matlab. what will b its code? how can I apply the filter on my data?</p>Maanvi Bhatnagarhttps://in.mathworks.com/matlabcentral/profile/authors/9070911-maanvi-bhatnagartag:in.mathworks.com,2005:Question/3573432017-09-19T09:47:51Z2017-09-19T09:47:51ZInput matrix in simple neural network<p>I have a matrix <i>inputs</i> of size 59209x8 which is my train data and a column <i>true_train_labels</i> of size 59209x1 which is the labels.</p><p>I am creating a neural network which has 1 hidden layer with 5 neurons like this:</p><pre class="language-matlab">col_size = length(inputs(1,:));
for i = 1: length(inputs)
% create network
net = network( ...
col_size, ... % numInputs, number of inputs,
1, ... % numLayers, number of layers
1, ... % biasConnect, numLayers-by-1 Boolean vector,
randi([0 1],1,col_size), ... % inputConnect, numLayers-by-numInputs Boolean matrix,
1, ... % layerConnect, numLayers-by-numLayers Boolean matrix
1 ... % outputConnect, 1-by-numLayers Boolean vector
);
</pre><pre> net.layerWeights{1,3}.delays = [1];
% number of hidden layer neurons
net.layers{1}.size = 5;</pre><pre> % hidden layer transfer function
net.layers{1}.transferFcn = 'logsig';</pre><pre> % network training
net.trainFcn = 'trainlm';
net.performFcn = 'mse';
%view(net)</pre><pre> tic
[net,tr] = train(net,inputs(i,:),true_train_labels(i));
toc</pre><pre> end </pre><p>The problem I have is with how I am going to pass the <i>inputs</i> inside the <i>train</i> function.
Each row from <i>inputs</i> is a recording and each column is a channel from the device I got the data.</p><p>The error I get is <b>Network contains a zero-delay loop</b>.</p><p>Any suggestion on how I should input my data would be useful.</p><p>Thanks in advance,
Ioannis</p>Ioannis Agalliadishttps://in.mathworks.com/matlabcentral/profile/authors/10267396-ioannis-agalliadistag:in.mathworks.com,2005:Question/3570462017-09-17T10:37:43Z2017-09-19T09:45:34Z[Zynq ad9361 fmscomms2] Frame Size increase<p>Hello,</p><p>I'm working in a project related to design a SDR communication system
to streaming video used on QPSK modulation.</p><p>Hardware is ad9361 fmscomms2 with zedboard</p><p>We based on this example : <a href = "https://www.mathworks.com/help/supportpkg/xilinxzynqbasedradio/ug/zedboardandfmcomms234transmitter.html">https://www.mathworks.com/help/supportpkg/xilinxzynqbasedradio/ug/zedboardandfmcomms234transmitter.html</a></p><p>And i have some question about the interface model example</p><p>zynqRadioHWSWQPSKAD9361AD9364SL_interface.</p><ul><li>In the data generation part as i understand in the "for iteration
subsystem" we packing 200xdouble same message data (154 data + 26
barker code + 20 bernoulli i will call it a packet)x50 times to
construct 10000xdouble data frame length.</li></ul><p>Can I change it to packing only one packet without iterator the same
packet data.</p><p>Because I planning to support ethernet frame with MTU is 1500. The
message data now is 22 bytes (*Zynq HW/SW Co-design*) and I want to
increase it.</p><ul><li>Another problem is when data is transfer from ARM to PL and PL to
ARM through DMA we alway get a error in first bytes. When I select src
select from ARM. And I don't know why.</li></ul><p>Many thanks.</p>hoang viethttps://in.mathworks.com/matlabcentral/profile/authors/7031254-hoang-viettag:in.mathworks.com,2005:Question/3573422017-09-19T09:45:32Z2017-09-19T09:45:32Zaugmented dickey fuller Matlab<p>I need to employ Dickey-Fuller test in Matlab, but instead of this test in Matlab exist only augmented Dickey-Fuller test (adftest). There is the explanation in Matlab help (https://www.mathworks.com/help/econ/adftest.html) that we can "Conduct a Dickey-Fuller Test Without Augmentation" what is "Test a time series for a unit root using the default autoregression model without augmented difference terms." Does it mean that this case is Dickey-Fuller test (without augmentation) for which I am looking for?</p>Janhttps://in.mathworks.com/matlabcentral/profile/authors/8968772-jantag:in.mathworks.com,2005:Question/3568522017-09-15T13:42:49Z2017-09-19T09:44:50ZCan I directly upload matlab output to github repistory?<p>I produce outputs which I do not need to have on my computer, but I would like them to be uploaded to GitHub. How can I save my files like this?</p>Pal Szabohttps://in.mathworks.com/matlabcentral/profile/authors/9015404-pal-szabotag:in.mathworks.com,2005:Question/3572952017-09-19T05:07:03Z2017-09-19T09:40:21ZCan anyone help me?<p>Here is the condition:</p><p>The first element of the sequence is: Sn = d where d is a positive integer.</p><p>The remaining elements are defined via: Sn+1 = {(Sn/2) if Sn is even
3*Sn + 1 if Sn is odd}</p><p>Using a while loop, find out how many iterations it takes for the sequence to reach 1 for d = 27 and
plot Sn versus n for d = 27. If this seems interesting to you, try a few other values of d. Can you
find one for which the sequence takes longer to reach 1?</p>Lawrence Blundohttps://in.mathworks.com/matlabcentral/profile/authors/10917824-lawrence-blundotag:in.mathworks.com,2005:Question/3573392017-09-19T09:39:47Z2017-09-19T09:39:47ZError when importing the ARXML file<p>I have received a ARXML and when trying to import it the next error cames up, any idea what is the problem? I am using the version 2017a.</p><p>>> a=arxml.importer('SCM.arxml')</p><p>a =</p><p>The file "C:\SCM\SCM.arxml" contains:
Error using Simulink.metamodel.arplatform.ArxmlImporter/read
Assertion failed: Can't convert string '' to INT32_T at b:\matlab\src\m3i\kernel\primitive\valueobject\valueobjectimpl.cpp:33:</p><p>Error in autosar.mm.arxml.Importer/import</p><p>Error in p_update_read</p><p>Error in p_getcomponentnames</p><p>Error in arxml.importer/getApplicationComponentNames (line 16)
compList = p_getcomponentnames(this, 'asc');</p><p>Error in arxml.importer/display</p><p>>></p>Jordi llovellhttps://in.mathworks.com/matlabcentral/profile/authors/6725638-jordi-llovelltag:in.mathworks.com,2005:Question/3573112017-09-19T06:55:16Z2017-09-19T09:32:33ZHow to get the LSB of a number?<p>If suppose the number is 110110, how to get its LSB in matlab?</p>Darsana P Mhttps://in.mathworks.com/matlabcentral/profile/authors/9051001-darsana-p-mtag:in.mathworks.com,2005:Question/3567432017-09-14T18:44:36Z2017-09-19T09:32:31ZUsing countourf for 1D vectors<p>Hi.</p><p>I have 3 unidimensional vectors like: x=[x1,x2,x3,...]; y=[y1,y2,y3,...] and z=[z1,z2,z3,...].
z is a function of x and y, and I have a pair x/y for each z value z1=f(x1,y1).</p><p>If a try to use contourf, I need a matrix and I get a lot of NaN elements, with these NaN I cant't reach a good visualization of my signal.</p><p>Would you have some solution to display some level courbes with just the vectors?</p><p>Thank you.</p>Güinther SAIBROhttps://in.mathworks.com/matlabcentral/profile/authors/4790333-guinther-saibrotag:in.mathworks.com,2005:Question/2998802016-08-17T11:38:49Z2017-09-19T09:30:22ZMATLAB 2016a error: "The desktop configuration was not saved successfully"<p>After a fresh install of MATAB 2016a (along side MATLAB 2015b) on a Win7 machine I get the following error message whenever I start MATLAB:</p><pre class="language-matlab">The desktop configuration was not saved successfully
</pre><p>I've seen previous posts about this problem, the suggestion on all of them boils down to checking file permissions for the preferences directory (i.e the directory returned by prefdir) and if that doesn't work then deleting MATLABDesktop.xml and restarting MATLAB.</p><p>I've tried both approaches and in fact the above message appears also when MATLAB is run as Administrator. It seems that MATLAB is able to write the MATLABDesktop.xml (it reappears after I delete it and restart MATLAB) but the file contents are always empty.</p><p>Possibly related: <a href = "http://www.mathworks.com/matlabcentral/answers/281905-matlab-r2016a-doesn-t-save-user-settings?s_tid=answers_rc1-1_p1">MATLAB R2016a doesn't save user setting</a>. Similar to that case I have Oracle Java 8 set as MATLAB_JAVA, but I do not get any exception on startup except for the above error. My MATLAB 2015b installation uses the same MATLAB_JAVA but does not fail in saving my preferences.</p><p>Any help is appreciated.</p>Stavhttps://in.mathworks.com/matlabcentral/profile/authors/4254574-stavtag:in.mathworks.com,2005:Question/3573002017-09-19T05:49:10Z2017-09-19T09:30:09ZWhat is problem?<img src = "/matlabcentral/answers/uploaded_files/88375/search1.PNG"><p>I want to apply this code on another image, but i am getting this problem, and the image can not be shown.</p><img src = "/matlabcentral/answers/uploaded_files/88376/mathlab.PNG"><p>Please any help</p>Haseeb Hassanhttps://in.mathworks.com/matlabcentral/profile/authors/10023405-haseeb-hassantag:in.mathworks.com,2005:Question/3573172017-09-19T07:43:00Z2017-09-19T09:27:55ZSave function results in a vector<p>I need help with a function to calculate the SINR of a LEO link to a certain position. I explain how it should work:</p><p>1. Generate the coordinates of the satellites through a function. This function returns an array of [n_satelitesx2] where the first column is latitude and the second column is the length: [LoS1j; LaSi2]. I have this done. (I.e.</p><p>2. Calculate at an angle formed at one point on the earth for each coordinate. This I do through a function that returns the ang and the distance of the satellite to the point of the Earth, that is, two values, as a function of LoS and LaS. The value of the distance I do not need in this new function.</p><p>3. Compare the value of ang. If ang <10, the coordinates are good and I have to calculate the signal strength for those coordinates.</p><p>4. Add all the signal power values of the previous coordinates.</p><p>The specifications I have made are simply to clarify the problem as they do not interfere with the development of loops.</p><p>I hope you can help me</p>Ainoa Garcíahttps://in.mathworks.com/matlabcentral/profile/authors/6270628-ainoa-garciatag:in.mathworks.com,2005:Question/3573332017-09-19T09:12:00Z2017-09-19T09:25:59ZIn "nchoosek" function, how to do some of elements of matrix are the same? <p>the title just is question.</p><p>I want to get including that</p>Brian Kimhttps://in.mathworks.com/matlabcentral/profile/authors/8072373-brian-kimtag:in.mathworks.com,2005:Question/3573262017-09-19T08:42:46Z2017-09-19T09:25:31ZHow to set XTickLabel with equal width between the ticks?for 1,2, 127, and 128<p>width between 1 and 2 is small, similarly for 127 and 128. I need equal width for 1,2,127 and 128</p>sohail hameedhttps://in.mathworks.com/matlabcentral/profile/authors/11005622-sohail-hameedtag:in.mathworks.com,2005:Question/3573342017-09-19T09:22:11Z2017-09-19T09:22:11Zwhat is the difference in usage between function im2bw(Image) and im2bw(Image,graythresh(Image))?<p>I used the default of the function im2bw without additional parameter, and I used im2bw by adding Otsu threshold to the function im2bw. I need to learn what the default value of threshold that used in default im2bw?</p>Abdelrahiem Hashemhttps://in.mathworks.com/matlabcentral/profile/authors/8121700-abdelrahiem-hashemtag:in.mathworks.com,2005:Question/3573292017-09-19T08:55:50Z2017-09-19T09:20:45ZHow can I update plots with large date<p>I have been developed the recording software for neural signal.
DAQ board record signal in high sampling rate (20000kHz) on 32ch and send them to PC through USB.
And I draw 32 subplot and plot 10000 samples on each channel (32 * 10000 = 320,000 samples)</p><pre class="language-matlab">set(dataLine, {'Ydata'}, num2cell(Amplifiers, 2));
</pre><p>I update using set function, and It spends about 15~18ms.
Is there any method to make it faster? when I check the resources, my program used 20~30% of cpu, 5% of GPU, 4GB ram.</p>sungwon minhttps://in.mathworks.com/matlabcentral/profile/authors/5080827-sungwon-mintag:in.mathworks.com,2005:Question/3573322017-09-19T09:10:50Z2017-09-19T09:10:50ZDownload triaging data from metrics<p>We run the polyspace (bugfinder and codeprover) jobs in CI. CI generates a html report, which can be viewed by engineers. When a tag is applied, CI also uploads to the metrics server. Engineers then use the web interface and the javascript to perform triaging (severity, status, comment) on the found issues.</p><p>The html report that is exported from CI, does not contain the triaging data which happened on the server. So we would like to amend the results of local analysis with the most recent triaging data on the server.</p><p>I found the polyspace-results-repository command, but couldn't figure a way to download the triaging data and amend it to the recent local analysis. We need this both for bugfinder and codeprover.</p>Stein Heselmanshttps://in.mathworks.com/matlabcentral/profile/authors/8107921-stein-heselmanstag:in.mathworks.com,2005:Question/3568172017-09-15T09:01:23Z2017-09-19T09:05:19ZWhy does this matrix contain different values depending on how it is accessed?<p>I am reading an mps file with the built-in matlab function mpsread. Specifically, I am trying to read the kb2 problem from the NETLIB database. The resulting left-hand side constraint matrix (that is sparse) exhibits some odd behavior. The following two commands result in different outcomes (the matrix's name is Aineq):</p><pre class="language-matlab">Aineq % shows that its entry on (15,41) is -0.31
Aineq(15,:) % shows that its entry on (15,41) is 0
</pre><p>Is this a common bug in using mpsread or is something else going on here?</p><p>EDIT: The following screenshot should correctly indicate what is going on:</p><img src = "/matlabcentral/answers/uploaded_files/88292/Matlab.PNG"><p>Here, one would say that the first command would also have to include the entry found in row 15, column 41 that the second command does print. I have attached the matrix in a '.mat' file as well.</p>Ernst Rooshttps://in.mathworks.com/matlabcentral/profile/authors/7488261-ernst-roos