https://www.mathworks.com/matlabcentral/answers/questions.atomMATLAB Answers — New Questions2017-02-21T21:38:20Ztag:www.mathworks.com,2005:Question/3262512017-02-21T21:38:20Z2017-02-21T21:38:20ZSquare root of a matrix<p>I encountered a problem when I try to compute the square root of a positive definite matrix</p><p>syms x real</p><p>mi = [1; exp(x); exp(2*x); exp(3*x); exp(-x)];</p><p>F = vpa(simplify(int(mi*mi',x,-10,0), 'Steps', 100)); Fs = sqrtm(F);</p><p>The problem here is Fs should be a symmetric matrix but Fs- Fs' here is not a zero matrix.</p><p>I have tried to use symbolic calculation instead of vpa but it seems that it requires a very long time to compute.</p><p>Is there any way that Fs can be computed without destroying its symmetric structure ?</p>Qian Fenghttps://www.mathworks.com/matlabcentral/profile/authors/5192873-qian-fengtag:www.mathworks.com,2005:Question/3262502017-02-21T21:37:15Z2017-02-21T21:37:15Zhow to load protein sequence into neural network<p>I have downloaded a fasta file and want to input it to neurofuzzy system in matlab. how do i filter the sequence and how to import it to the network.
Thanks in advance for any replies...</p>Vijaya Maringantihttps://www.mathworks.com/matlabcentral/profile/authors/7342740-vijaya-maringantitag:www.mathworks.com,2005:Question/3262472017-02-21T21:25:28Z2017-02-21T21:34:47ZHow to generate function after importing files<p>Hello,
I have student license of Matlab and after importing data I want to recreate what I just did and put it on one file to avoid doing it manually if I want to read multiple files. So I suppose that I need to "generate function". However, I can't do it interactively as I can with generate script.
So can anybody please help me with this issue?</p><p>Jo</p>Joël ESPELhttps://www.mathworks.com/matlabcentral/profile/authors/9233017-joel-espeltag:www.mathworks.com,2005:Question/1008862012-06-22T07:53:00Z2017-02-21T21:33:18ZHow can I download the results of a verification (unit-by-unit or integration) in the repository?<p>A verification in unit-by-unit or integration mode sent to the repository can not be downloaded from the spooler. It can be downloaded from Metrics if it's an integration verification, but a unit-by-unit verification, only one unit can be downloaded at a time.</p><p>We explain a possible workaround.</p>MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/3262492017-02-21T21:32:32Z2017-02-21T21:32:32ZHow to make two uneven sized tables of even length and check and fill in missing data with NaN?<p>Hi all,</p><p>So I have two tables with each three columns; Date, Time and a Variable. I want to plot the variables against each other, but unfortunately table 1 has more rows than table 2. They have the same start- and end date/time, but at some days table 1 contains more rows than table 2 which results in two tables of uneven length.</p><p>I would like to add the missing date and time rows to table 2 to make the tables of even length. For these added rows there is no variable value present in the third column, thus NaN should be entered here.
I should probably add that the tables contain around 38 million rows, so an if loop that checks each separate row is not doable.</p><p>I'm hoping you can help me out with this, thanks in advance!</p>Matthijs Priesterhttps://www.mathworks.com/matlabcentral/profile/authors/2202049-matthijs-priestertag:www.mathworks.com,2005:Question/3262062017-02-21T17:40:04Z2017-02-21T21:31:15ZFill matrix efficiently without loop<p>Hey guys!</p><p>I need to construct a matrix and want to do it the "right" way. I have heard that the use of loops in Matlab is very inefficient and even frowned upon. However, since I have a programming background it is hard for me to not jump straight to nested loops when it comes to dealing with matrices.</p><p>In this particular case I need to construce a nxn Matrix C witch is defined by: c_ij = sqrt((x_i-x_j)^2 + (y_i-y_j)^2 + G). The matrix is obviously symmetrical. I have saved the x and y values in seperat vectors aMaybe some of you recognize this as the Hardy interpolation.</p><p>Is there a way to do this elegantly without loops? Any help is highly appreciated (=</p>Markus Mikschihttps://www.mathworks.com/matlabcentral/profile/authors/9121835-markus-mikschitag:www.mathworks.com,2005:Question/3262482017-02-21T21:30:57Z2017-02-21T21:30:57Zdsolve returns imaginary components when it shouldnt..how to fix this?<p>I am having trouble with solving 2nd order differential equation with 'dsolve':</p><pre> % code
q=1*10^3; %N/m
L=2; %m
E=200*10^9; %Pa
I=177*10^-8; %m^4
syms W(x)
W=dsolve('D2W=(1/(E*I))*((-A*x)+q*((x^2)/2))','x')</pre><p>which returns solution</p><pre> % solution
W =- (q*exp(-1)*x^4*1i)/24 + (A*exp(-1)*x^3*1i)/6 + C3*x + C4</pre><p>when the solution should have zero imaginary components since solving by hand gives me:</p><pre> % by hand
W2=(1/(E*I))*(-A*(x^3)/6+q*(x^4)/24)+C0*x+C1</pre><pre> Any explanation or advice?</pre>Andrejhttps://www.mathworks.com/matlabcentral/profile/authors/9773816-andrejtag:www.mathworks.com,2005:Question/816812013-07-10T16:36:33Z2017-02-21T21:30:29Zi want to convert (.slx) format to (.mdl)format at this link: http://www.mediafire.com/?c5p02776wo6ly66<p><b>bold</b></p>hanyhttps://www.mathworks.com/matlabcentral/profile/authors/4406331-hanytag:www.mathworks.com,2005:Question/3262092017-02-21T17:50:01Z2017-02-21T21:29:47ZCompare matrices from different programs<p>I have two matrices created from two different programs. Matrix A from program A and matrix B from program B. The matrix sizes are same and I want to compare the elements of these matrices. Is that possible? If yes, how?</p>fiona rozariohttps://www.mathworks.com/matlabcentral/profile/authors/7037003-fiona-rozariotag:www.mathworks.com,2005:Question/3262462017-02-21T21:25:17Z2017-02-21T21:27:43ZAveraging image array values <p>I am trying to create an average filter to blur an image. I have my image array which has been padded stored in Y. Below is a section of my code trying to average individual red pixel values with its eight nearest neighbors. After running the code I get the error reading "Cannot convert double value 150 to a handle" I understand that something is wrong but I must compute the average manually in a similar fashion to the code below. (I cannot use a built in function to apply the filter.) Thanks in advance</p><p>Y = cat(3, newRed, newGreen, newBlue); %Re-stitches the RGB parts together
[r,c,p]=size(Y)
rows=r;
columns=c;
planes=p;</p><p>for i=2:r-1</p><p>for j=2:c-1</p><pre> Red(1,i,j)=Y(1,mean2(i-1:i+1),mean2(j-1:j+1))
end
end</pre>Mitch Whitehttps://www.mathworks.com/matlabcentral/profile/authors/9536792-mitch-whitetag:www.mathworks.com,2005:Question/3262212017-02-21T18:43:34Z2017-02-21T21:21:20ZHow Assign a Plot to a Specific Axes?<p>I have drawn two Axes in GUIDE.</p><p>How can I assign each of my plots to one of them?</p><p>when I now run it, MATLAB just put both plots on one another.</p>Rightia Rollmannhttps://www.mathworks.com/matlabcentral/profile/authors/8458004-rightia-rollmanntag:www.mathworks.com,2005:Question/3248542017-02-13T23:54:58Z2017-02-21T21:20:33ZProblem obtaining alpha channel of pngquant/tinypng files.<p>I am having trouble obtaining the alpha channel of a pngquant/tinypng file using imread. Is there another function that handles this properly?</p><p>Used:</p><pre class="language-matlab">[img,imgMap,imgAlpha] = imread('some_pngquant_file.png');
</pre><p>img (mxn uint8 matrix), imgMap (256x3 double matrix with values in [0,1]), imgAlpha is empty</p><p>img entries index into imgMap rows (RGB values in [0,1]). Could it be that I'm interpreting this improperly?</p>Ernest Woeihttps://www.mathworks.com/matlabcentral/profile/authors/7648373-ernest-woeitag:www.mathworks.com,2005:Question/3255952017-02-17T15:53:27Z2017-02-21T21:17:55ZHow to split up a large dataset into separate sub-datasets?<p>Hello everyone,</p><p>I'm working on a analysis of a large dataset which exists of multiple measurements in time at multiple locations. All datasets are stored under each other in a big text file. It looks like this:</p><p>[2] [2011] [location1] [other info]</p><p>[X1] [Y1] [X2] [Y2] ...... [Xi] [Yj]</p><p>[2] [2012] [location1] [other info]</p><p>[X1] [Y1] [X2] [Y2] ...... [Xi] [Yj]</p><p>[2] [20xx] [locationx] [other info]</p><p>[X1] [Y1] [X2] [Y2] ...... [Xi] [Yj]</p><p>All subdataset titles start with the number 2. The amount of measurements differs per subdataset. What I would like to have is one large structure which contains all measurements separately, from which I can easily extract data of some specific years/locations to make comparisons. I was hoping to find some method with which Matlab could recognize the start of a new subdataset, and then write this data into a field of a structure, and use some kind of loop to do this for all subdatasets. However, I was unable to fix this and unfortunately could not find any similar questions on the internet. I hope someone could help me. Thanks!</p>Martijn Bregmanhttps://www.mathworks.com/matlabcentral/profile/authors/3452692-martijn-bregmantag:www.mathworks.com,2005:Question/3262352017-02-21T19:51:35Z2017-02-21T21:16:10ZGUI customized layout prompt<p>Hello, I'm writing because I have a question regarding the layout of the GUI. Here's my code:</p><p>clc
clear all
prompt={"one","two:";
"three" , "four"};
% Create all your text fields with the questions specified by the variable prompt.
title="my title";
rowscols = 2
defaults = {' def1:','def2:';
'def3' ,'def4'};</p><p>cstr = inputdlg (prompt, title, rowscols, defaults)</p><p>However, it's not what I want. I would like to have two elements per row shown in the gui, and not a layout with four rows. How can I achieve that please?</p>aredhelhttps://www.mathworks.com/matlabcentral/profile/authors/4460818-aredheltag:www.mathworks.com,2005:Question/3262452017-02-21T21:07:25Z2017-02-21T21:29:00Zcondition if command is possible or not<p>I want to create a loop that runs through several matrices(A(:,:,n)) and create a condition;</p><pre> for i=1:length(A)
if inv(A(:,:,i) "is possible"
iv=inv(A(:,:,i));
elseif
disp('impossible')
end
end</pre><p>how do i syntax "if command is possible" or impossible?</p>Hbrohttps://www.mathworks.com/matlabcentral/profile/authors/8562869-hbrotag:www.mathworks.com,2005:Question/944362009-06-27T01:12:00Z2017-02-21T21:15:17ZIs there some way to measure the time difference between two successive rising edges of a pulse train signal using Simulink in MATLAB 7.7 (R2008b)?<p>I would like to measure the time elapsed between two successive rising edges of a pulse train signal using Simulink in MATLAB 7.7 (R2008b).</p>MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/3262342017-02-21T19:50:39Z2017-02-21T21:09:41Zmex function (c) same input different outputs<p>I have a mex function (waveadv_weno_1d_mex.c - attached)
which gives correct and incorrect answers roughly half the time (sometimes the incorrect ones are the right order of magnitude, sometimes they are up to 300 orders out), seen from a loop like the one below:</p><pre class="language-matlab">mex -largeArrayDims waveadv_weno_1d_mex.c;
load test_waveadv_weno_1d_mex;%inputs to mex function are in attached mat file
for j=1:100
Hmex = waveadv_weno_1d_mex(nx,dt,ADV_OPT,h0,u,LANDMASK,scp2,scp2i,scuy);
disp(max(Hmex)),pause
end
</pre><p>Would anyone have any idea what could be going wrong as I have no idea where to even start debugging this.</p>Timothy Williamshttps://www.mathworks.com/matlabcentral/profile/authors/6388352-timothy-williamstag:www.mathworks.com,2005:Question/3262392017-02-21T20:36:33Z2017-02-21T21:05:14ZHow to Specify the Size of Rectangles in a figure?<p>I have drawn 3 rectangles and put them in a struct as follows. It occupies the whole figure1 area. How to make them so small that just, for example, these rectangles just take one fifth of the figure1’s area?</p><pre class="language-matlab">hfig = figure;
for i = 1 : 3
W = 4;
X = i.* W;
Y = 0;
H = 8;
R = rectangle;
R.Position = [X Y W H];
G(i).r = R;
end
</pre>Rightia Rollmannhttps://www.mathworks.com/matlabcentral/profile/authors/8458004-rightia-rollmanntag:www.mathworks.com,2005:Question/3247422017-02-13T10:48:55Z2017-02-21T21:05:05ZHas anyone had problems with pdepe after upgrading to Matlab 2016 and Sierra?<p>I have upgraded my MAC to OSX Sierra and I had to also upgrade MATLAB to version 2016. Ever since then all my scripts using PDEPE do not work anymore.
I have tried running them on a PC and they do work. Having upgraded Matlab and the operating system at the same timw I don't know whether one of the two is the problem or the two together.
The error I get is
Assignment has more non-singleton rhs dimensions than non-singleton subscripts</p><p>Error in pdepe/pdeodes (line 359)
up(:,ii) = ((xim(ii) * fR - xim(ii-1) * fL) + ...</p><p>Error in odearguments (line 90)
f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.</p><p>Error in ode15s (line 150)
odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);</p><p>Error in pdepe (line 289)
[t,y] = ode15s(@pdeodes,t,y0(:),opts);</p><p>Anyone experiencing the same problem?
Thanks</p>Danihttps://www.mathworks.com/matlabcentral/profile/authors/3986732-danitag:www.mathworks.com,2005:Question/3262382017-02-21T20:31:44Z2017-02-21T20:59:48ZWhy mex -setup finds my compilers but xpcsetCC/slrtsetCC does not? <p>I am using <b>Matlab 2015a 32bits</b>. I am trying to download a simulink model to a Target PC. Unfortunately when I run <b>xpcsetCC -setup</b> or <b>slrtsetCC -setup</b> to set a C compiler, it returns <b>"No compilers found"</b>. At the same time, when I run mex -setup it returns all the installed compilers. I tried to set manually the path to the compiler using the command <b>xpcsetCC(TYPE, LOCATION)</b> with no success.</p><p>At the same computer I have installed <b>Matlab 2015b 64bits</b>. In that installation everything is working just perfect.</p><p>Thanks everyone in advance!</p>Giannis Tzhttps://www.mathworks.com/matlabcentral/profile/authors/9132750-giannis-tztag:www.mathworks.com,2005:Question/3262442017-02-21T20:59:04Z2017-02-21T21:01:33ZParallel-izing, speeding up simulation<p>Hello,</p><p>I am trying to simulate a stochastic equation and empirically determine it's pdf. I have the following code,</p><pre class="language-matlab">NN=100;
</pre><pre class="language-matlab">ind = @(x) (x>0);
x_vect=zeros(NN,1001);
</pre><pre class="language-matlab">for j=1:NN
ts = 0.01;
x0=0;
x_vect(j,1)=x0;
if (mod(j,1000)==0)
rng('shuffle')
end
for i=1:100000
w = rand(1,1);
if ~(w < ts)
if (x0-2*ind(x0)*ts>0)
x_vect(j,i+1)=x0-2*ind(x0)*ts;
else
x_vect(j,i+1)=0;
end
else
x_vect(j,i+1)=x0+1;
end
x0=x_vect(j,i+1);
end
end
</pre><p>Each sample path should last for 1000 seconds (so the inner loop runs till 10000) and I need to do a total of NN=100000 sample paths. Currently this would take me about 7 hours to run the simulation. Does anyone see an obvious way to speed up the simulation and/or parallelize this code?</p>Ivan Abrahamhttps://www.mathworks.com/matlabcentral/profile/authors/3339375-ivan-abrahamtag:www.mathworks.com,2005:Question/3260282017-02-20T20:30:42Z2017-02-21T20:51:41ZPlotting values with start time and timestep<p>Hello,</p><p>I've been delivered a set of values formatted like this:</p><img src = "/matlabcentral/answers/uploaded_files/70391/Uten%20navn.png"><p>I want to plot the graph for material 1, as function of the start time and the time step.</p><p>Please consider the following code:</p><pre class="language-matlab">filename = 'Material_Characterisation.xlsx';
num = xlsread(filename);
Test = [0:2*10^(-9):2*10^(-4)].';
plot(Test,var); grid on;
</pre><p>Where I've managed to isolate the values i need for material 1 as variable var, which is a 100001x1 matrix.</p><p>The problem is that the start time is 3.16*10^(-5) and I want to plot the graph for each time step.</p><p>Any help is greatly appreciated.</p><p>Regards</p><p>Andreas</p>Andreas Soto Petersonhttps://www.mathworks.com/matlabcentral/profile/authors/8750481-andreas-soto-petersontag:www.mathworks.com,2005:Question/3255682017-02-17T13:08:51Z2017-02-21T20:49:39ZHow can I extract a line from a surface?<p>Hello everybody, I would like to extract a line from a surface.
I already represent quite easily with the commands <i>plot3</i>, <i>mesh</i> and <i>surf</i> my surface, that is divided in three parts because it represents three different domains. My initial input (in attachment the file InputValues.txt)is composed by a matrix (18011*3) of Longitude, Latitude and Depth values.
I would like to build a function that in input takes the position of start (A) and end of my profile (B) (xa,ya,xb,yb) and in output return the position of the corresponding z in A and B {e.g. [A,B] = myfunc(xa,ya,xb,yb)}. Finally, I would like to plot the obtained curve after cutting my surface with a vertical plane.
I have already achieved this result with another software (Global Mapping Tools, very used in geophysical applications), but now I'd like to obtain the same thing in Matlab environment, of which I am quite new.
Someone is familiar with these kind of problems?
Do you have any suggestions, please?
Thanks in advance,</p><p>Leonardo</p>Leonardo Colavittihttps://www.mathworks.com/matlabcentral/profile/authors/9636404-leonardo-colavittitag:www.mathworks.com,2005:Question/3262432017-02-21T20:45:54Z2017-02-21T20:47:57ZTrying to get my Cellular Automata code to work but I having trouble<p>The idea is that I have a matrix of 7x7 cells and the 5 cells in the middle are proliferating cells (P=1)...x(4,3)=1;x(3,4)=1;x(4,4)=1;x(5,4)=1;x(4,5)=1;...this is the initial configuration of my 'tissue model'. The idea is at a time step, each tumorous cell at the last time step is randomly chosen with equal probability one by one.
SO at the start a profilerating cell could be chosen which could replicate a nearby cell to a 1.. OR change the original cell to a Quiescent cell (=2)... OR an empty cell (=0) could be chosen and nothing will happen.</p><p>When the selected cell is picked a random number R has to be picked... this R is ALSO used to satisfy arguments about what will happen the cell with the parameters that are in the code. Essentially I need the cells to change from 0 to 1 to 2 to 3 (3= death cell) 1 by 1 in each time step to show how the 3 different cancer cells grow.</p><p>Profrate=Prof_rate*(1-P/K);</p><p>%Parameters</p><p>Prof_rate=0.85; Binding_rate=0.1;
Escape_rate=0.5;Lysis_rate=0.35;K=20;</p><p>x=zeros(7,7);
x(4,3)=1;
x(3,4)=1;
x(4,4)=1;
x(5,4)=1;
x(4,5)=1;%% 5 profilerating cells</p><p>%set up the starting matrix
for t= 1:10; %%time loop
R=Random;%% call the random number generator</p><pre class="language-matlab">stages=zeros(size(x,1),size(x,2),1,1);%this is going to be a 'movie'
%%stages is a variable of type double
</pre><pre class="language-matlab">if any(x(:)==0) %%nothing happens
%generate a map for the distances to filled pixels
distances=bwdist(x);%%bwdist returns the distance to the closest non-zero point in a matrix
%find all indices that are distance 1 to white pixels (so these pixels
%are the neighbours)
[r,c]=find(distances==1);
%select a random position
pos=ceil(rand()*length(r));%%ceil(X) rounds the elements of X to the nearest integers
%%towards infinity.
r=r(pos);
c=c(pos);
if R <= Profrate;
%fill the new position
x(r,c)=1; %%random Neigbour becomes another Profliferating cell
%save the new state to the 'movie'
stages(:,:,1,end+1)=x;
</pre><pre> else R =< 1 - Lysis_rate;
x(r,c)=2; %% Profilerating cell becomes a Quiescent
end</pre><pre> %save the new state to the "movie'</pre><pre class="language-matlab">%%stages=zeros(size(x,1),size(x,2),2,2);%% don't know if that is correct
</pre><pre class="language-matlab">else [r,c]=find(distances==2);
if R<= Escape_rate;
x(r,c)=1; %%another profilerating cell
else R => 1-Lysis_rate;
x(r,c)=3; %% becomes a necrotic cell
end
end
end
</pre><pre class="language-matlab">%display the 'movie'
montage(stages)
</pre>Cathy O Connellhttps://www.mathworks.com/matlabcentral/profile/authors/9751157-cathy-o-connelltag:www.mathworks.com,2005:Question/3262422017-02-21T20:44:47Z2017-02-21T20:44:47ZI really need your help, thanks!! I have a function eg. f = 1/2 ks^2, wenn i get the distribution of f, eg normal distribution(take mean value of f = 100 as an example), how can i get the distribution of s? k = lhsnorm(3,0.1,n). Is it possible?<p>This is the code for the function at the beginning
i = 50;
n = 200;
s = linspace(1,10,i);
k = lhsnorm(3,0.1,n);
for m = 1:n %plot range
f=0.5*k(m)*s.^2;
plot(s,f,'color','r','Marker','.','LineWidth',0.2,'markeredgecolor','g') ;
hold on ;
end</p>Fan Mohttps://www.mathworks.com/matlabcentral/profile/authors/9703462-fan-motag:www.mathworks.com,2005:Question/3262412017-02-21T20:38:51Z2017-02-21T20:38:51ZPolygon ROI extraction from an image<p>Hi,
I want to extract a polygon ROI from an image and work with that ROI further. How can I extract the ROI from the image and save it as an array??</p>M. M. Farhadhttps://www.mathworks.com/matlabcentral/profile/authors/8686119-m-m-farhadtag:www.mathworks.com,2005:Question/3262402017-02-21T20:38:37Z2017-02-21T20:38:37ZImage Analysis with flow and gray scale<p>Hello. I am trying to calculate the percentage of the white foam for this image. I am struggling because I can either do a 8 bit binary black and white but it takes out some of the foam that is less dense and not completely white. The color of the foam varies. The second way I approached it was using a RBG analysis. I basically just analyzed the closest ranges for gray to white and black as the background.</p><p>Do any of you know how to separate the foam from the background more accurately?</p><p>Thanks</p><pre> I = imread('test5.png') ;
figure;
imshow(I)
BW = im2bw(I,0.4);
figure; imshow(BW)
percentageBlack=(1-nnz(BW)/numel(BW))*100</pre><pre class="language-matlab">%%%%another method
</pre><pre class="language-matlab">clear all
clc
</pre><pre class="language-matlab">filename = 'test5.png';
RGB = imread(filename);
grayscale = rgb2gray(RGB);
</pre><pre class="language-matlab">numTotalPixel = size(grayscale,1) * size(grayscale, 2);
numBlackPixel = sum(grayscale(:)<= 80);
numWhitePixel = sum(grayscale(:)>140);
numGrayPixel = sum(grayscale(:)>80)-numWhitePixel;
</pre><pre class="language-matlab">percentBlackPixel = numBlackPixel / numTotalPixel * 100
percentWhitePixel = numWhitePixel / numTotalPixel * 100
percentGrayPixel = numGrayPixel / numTotalPixel *100
</pre>Christine Neehttps://www.mathworks.com/matlabcentral/profile/authors/3089154-christine-neetag:www.mathworks.com,2005:Question/3262302017-02-21T19:39:49Z2017-02-21T20:37:03ZIntegration with negative support<p>Hi, I would like to integrate something like this</p><pre> z=@(x) x<0;
integral(exppdf(z,10),-0.5, 0.5);</pre><p>Any help will be useful. Thanks</p>Nikolashttps://www.mathworks.com/matlabcentral/profile/authors/3940981-nikolastag:www.mathworks.com,2005:Question/3262012017-02-21T17:12:07Z2017-02-21T20:34:49ZHow do I calculate the function of a curve with the known arc length and ending point coordinates?<p>I'm trying to plot a curve, and I know the length of the curve, the angle of the curve (pi-2*pi), and the ending point coordinates.</p><p>My thought is to use the Arc Length formula in reverse, since the curve will always be an arc, and derive each side.
Here is a link to an example finding the Arc Length.</p><p><a href = "https://www.mathworks.com/help/matlab/math/integration-to-find-arc-length.html">https://www.mathworks.com/help/matlab/math/integration-to-find-arc-length.html</a></p><img src = "/matlabcentral/answers/uploaded_files/70473/Capture.PNG"><p>But I'm not sure how to handle the Arc Length (L) derivation.</p><p>E.g., my arc length is 6, going from pi to 2*pi, and points are [4,10] and [0,16]; If I say L=6 and derive both sides to cancel the integral, then I end up getting imaginary numbers, and I know something went wrong. Since L is really an equation (e.g., cos(x)+3 from pi to 2*pi). I think I may have 2 equations, but I'm generally confused on how to move forward, or if it's even possible.</p><p>Can anyone tell me if this is solvable, and if so, how?</p><p>Thanks a lot for your time!</p>Fredhttps://www.mathworks.com/matlabcentral/profile/authors/5532279-fredtag:www.mathworks.com,2005:Question/1003492012-01-20T14:28:00Z2017-02-21T20:33:06ZHow do I print my figure to a file of publication quality?<p>I would like to print my figure to a file of publication quality.</p>MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/1004412010-08-05T21:58:00Z2017-02-21T20:33:03ZWhy am I unable to generate bytes-available events from my Serial port ?<p>Why am I unable to generate bytes-available events from my Serial port ?</p><p>I have a problem using an action function property in a serial connection with MATLAB. I want to connect the serial port of my computer to a device in interrupt mode (when my computer receives 10 bytes from the serial port, plot this data). I used the BytesAvailableAction function and these two scripts:</p><p>The first script is connect.m to establish a connection:</p><p> </p><pre class="language-matlab">global s
s=serial('com1');
s.bytesavailableactionmode='byte';
s.bytesavailableactioncount=15;
s.bytesavailableaction='plotout';
fopen(s)
</pre><p>The MATLAB file that I expect to run when acquisition is interrupted is plotout.m:</p><p> </p><pre class="language-matlab">function plotout(obj,event)
global s
global in1;
if s.bytesavailable>1
in1=fread (s,s.bytesavailable/2,'int16');
load in in
ts=size(in);
tad=size(in1);
in(1,ts(2)+1:ts(2)+tad(1))=in1';
save in in
plot(in)
pause
end
</pre><p>When I use these MATLAB files, plotout executes only one time and stops until I push the ‘Enter’ button.</p><p>I send 45 bytes to my computer's serial port from another port (COM2) with these commands:</p><p> </p><pre class="language-matlab">s2=serial('com2');
fopen(s2)
for i=1:45
fwrite(s2, i,’int16’);
end
</pre><p>When it receives the first 15 bytes, it plot this data and stops, and I must push the ‘Enter’ button.</p><p>I want to be able to plot all the received data automatically without my interference</p>MathWorks Support Teamhttps://www.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:www.mathworks.com,2005:Question/3254202017-02-16T15:37:46Z2017-02-21T20:29:05ZHow to define figure position in subplot1?<p>Dear all,</p><p>I would like to use subpot1:
https://se.mathworks.com/matlabcentral/fileexchange/9694-an-improved-subplot-function/content//subplot1.m</p><p>Could you please let me know how to define the position where I want to plot a figure?</p><p>I have defined the position as follows with the function subplot:
subplot(1,3,1)
subplot(1,3,2)
subplot(1,3,3)
...
So, the last argument defines the position.
However, that doesn't work with subplot1</p><p>Best,
Maria</p>Mariahttps://www.mathworks.com/matlabcentral/profile/authors/2960701-mariatag:www.mathworks.com,2005:Question/3262112017-02-21T17:53:23Z2017-02-21T20:26:07ZOrganising/Sorting imported files into matlab<p>Hello,</p><p>I have a series of frames (files) that I would like to read into matlab with each file called Frame1.jpg, Frame2.jpg and so on. I was wondering if there is anyway to read these into matlab in order? Matlab organises them all to using the first integer to begin with, so it reads Frame1.jpg, Frame.10jpg and so on.</p><p>Any help would be much appreciated.</p><p>Kind regards</p><p>Liam</p>Liam Thurstonhttps://www.mathworks.com/matlabcentral/profile/authors/9680615-liam-thurstontag:www.mathworks.com,2005:Question/3262372017-02-21T20:25:46Z2017-02-21T20:25:46ZWhere am I going wrong? I'm writing the Jacobian Matrix for a robot (KUKA LWR or iiwa).<pre class="language-matlab">%%defining DH-Parameters
syms q1 q2 q3 q4 q5 q6 q7 d3 d5 z p
a=[90 -90 -90 90 90 -90 0];
d=[0 0 d3 0 d5 0 0];
b=[q1 q2 q3 q4 q5 q6 q7];
%%Calculating Rotation Matrix
T=eye(4);
for i=1:7
%%because cos(pi/2)=!0 ,so we use degrees instead of rads for a
%%matrix
A=[cos(b(i)) -sin(b(i))*cosd(a(i)) sin(b(i))*sind(a(i)) 0;
sin(b(i)) cos(b(i))*cosd(a(i)) -cos(b(i))*sind(a(i)) 0;
0 sind(a(i)) cosd(a(i)) d(i);
0 0 0 1];
T=T*A;
z(i)=T(1:3,3)
p(i)=T(1:3,4)
end
R=T(1:3,1:3)
P=T(1:3,4)
J=[z(1)*(p(7)-p(1)) z(2)*(p(7)-p(2)) z(3)*(p(7)-p(3)) z(4)*(p(7)-p(4)) z(5)*(p(7)-p(5)) z(6)*(p(7)-p(6));z(0) z(1) z(2) z(3) z(4) z(5) z(6)]
</pre>Sina Keshavarzhttps://www.mathworks.com/matlabcentral/profile/authors/9226773-sina-keshavarztag:www.mathworks.com,2005:Question/3260492017-02-21T01:25:43Z2017-02-21T20:23:02ZHow to plot non equally spaced data in an equally spaced fashion.<p>I am trying to plot some data:</p><p>x=[10 50 100 500 1000 1500 2000 2500 3000]; %data points</p><p>y=[74.6 88.8 89.6 92.1 92.5 88.8 88.8 87.9 85.4]; %accuracy(%)</p><p>The problem I am facing is that I cannot plot the data in an equally-spaced grid plot (including the tick locations).
This is an example of what I want to achieve:</p><img src = "/matlabcentral/answers/uploaded_files/70407/accuracy.png"><p>Thanks for your help in advance.
Raul</p>RFRhttps://www.mathworks.com/matlabcentral/profile/authors/1784775-rfrtag:www.mathworks.com,2005:Question/3258262017-02-19T16:07:39Z2017-02-21T20:23:38ZHow to fill edges only in Blob area<p>I am able to draw a blob inside an image and then i want to extend the blob until it hit's black line or edge,simple suggestions on how to do it?</p><p>for example i had a circle edge here black i want to extend red blob if hit to an edge then stop extending.note only fill those areas where i place these blob.</p><img src = "/matlabcentral/answers/uploaded_files/70491/Untitled.png">Hash irhttps://www.mathworks.com/matlabcentral/profile/authors/8853028-hash-irtag:www.mathworks.com,2005:Question/3262362017-02-21T20:20:13Z2017-02-21T20:20:13ZHow can I view image in . mha format?<p>Dear all,</p><p>I have some images in .mha format and I would like to view these images. But this <b>http://www.mathworks.com/matlabcentral/fileexchange/29344-read-medical-data-3d</b> script only load data into current folder, but not view.</p><p>Can you advise me?
Thank you for your answers</p>Veronikahttps://www.mathworks.com/matlabcentral/profile/authors/5886404-veronikatag:www.mathworks.com,2005:Question/3262252017-02-21T19:08:08Z2017-02-21T20:17:42ZWindows 10 AE Compatibility<p>Dear MathWorks,</p><p>What is the Windows 10 AE Compatibility for the MATLAB application?</p><p>Thank,</p><p>Scott Harmon
CB&I</p>Scott Harmonhttps://www.mathworks.com/matlabcentral/profile/authors/9773120-scott-harmontag:www.mathworks.com,2005:Question/603452013-01-30T09:54:34Z2017-02-21T20:16:24ZFilled contour plot problem: colors and contour lines mismatch<p>The aim is to create a filled contour plot with a matching colorbar.
I have done this very often, but now I have a matrix of ocean salinity which is not plotted correctly. I have reduced the skript to the following lines, after loading the matrix "isalt", which contains Nans at the borders and values in the range of "csal" in between.</p><pre class="language-matlab">csal=[34.76:0.02:34.98];
</pre><pre class="language-matlab">figure(1)
</pre><pre class="language-matlab">[C,h]=contourf([1:72],[1:20],isalt,csal);
colormap(jet(length(csal)-1));
caxis([csal(1) csal(end)]);
colorbar;
</pre><p>The plot looks fine until "caxis" is carried out.</p><p>I am new in this forum and cannot find a possibility to upload the .mat file containing the matrix and the resulting figure :-/</p><p>But maybe someone has an idea...</p>Kerstinhttps://www.mathworks.com/matlabcentral/profile/authors/4027118-kerstintag:www.mathworks.com,2005:Question/3262262017-02-21T19:08:36Z2017-02-21T20:13:02ZLicense checkout as different user<p>Hello,</p><p>Is there a method of checking out a license from the license server using a different user account?</p><p>I have a computer which is not on a domain, so I login with a local account. But I need to checkout the license using a domain account.</p><p>I tried using runas.exe to launch MATLAB as the domain user, but it is failing for a reason I haven't been able to track down yet.</p><p>I'd like to find a solution I can implement in MATLAB as opposed to the OS.</p><p>Thank you,
Mike</p>Michael Kantorhttps://www.mathworks.com/matlabcentral/profile/authors/1272268-michael-kantortag:www.mathworks.com,2005:Question/3260922017-02-21T07:25:58Z2017-02-21T20:08:15ZControllable and observable canonical form<p>Hi,
I want to convert a transfer function to controllable and observable canonical form. Tried with tf2ss but it did not work. I am sharing a part of my code. Is there any way to get those A,B,C,D matrices by any Matlab functions??</p><p>My code:</p><p>clc;
clear all;</p><p>Den=[0 1 1];
Num=[1 5 6];</p><p>s=tf(Den,Num)</p><p>[A B C D]=tf2ss(s)</p>M. M. Farhadhttps://www.mathworks.com/matlabcentral/profile/authors/8686119-m-m-farhadtag:www.mathworks.com,2005:Question/3254012017-02-16T14:07:08Z2017-02-21T20:07:34Ztypical mesh generation and surf plot ?<p>Hello.
I'd like to ask you how can I make the typical mesh and its 3D figure in the following code:</p><pre class="language-matlab">%%
clc; clear; close all;
%%
tic;
h0 = 1.0;
g = 20;
a1 = 1; % dimensionless amplitude
a2 = 0.1; % dimensionless amplitude
c0 = sqrt(g*h0); % dimensional velocity
</pre><pre class="language-matlab">v1 = sqrt( 1 + 2*a1/3);
P1 = 2*a1*h0/3;
Q1 = sqrt(a1/2)/(v1*h0);
R1 = v1*sqrt(g*h0);
</pre><pre class="language-matlab">%
x1 = 0; % initial position
</pre><pre class="language-matlab">beta = 0.1;
</pre><pre class="language-matlab">it_M = 21;
ep = 16;
</pre><pre class="language-matlab">%% Domain
% x domain
x_max = 20; x_min = -10;
% x = (x_min:0.5: )
N1 = 61;
x = linspace(x_min,x_max, N1)';
dx = x(2) - x(1);
</pre><pre class="language-matlab">% t domain
t_max = 1; N2 = 11;
t = linspace(0, t_max, N2)';
dt = t(2) - t(1);
</pre><pre class="language-matlab">% k domain
k_max = 2; N3 = 201;
k = linspace(0, k_max, N3)'*pi;
dk = k(2) - k(1);
</pre><pre class="language-matlab">% omega
ga = sqrt( (c0^2*k.^2 + beta)./(1+h0^2*k.^2/3) );
</pre><pre class="language-matlab">%% linear solution
u_con = zeros(N1, N2);
for n2 = 1:N2
u_con(:, n2) = P1*(sech(Q1*(x - R1*t(n2) - x1))).^2 ;
end
%%
figure;
surf(x, t, u_con', 'linestyle', 'none')
xlabel('$x$', 'Interpreter', 'latex', 'fontsize', 18)
ylabel('$t$', 'Interpreter', 'latex', 'fontsize', 18)
zlabel('$\eta_{linear}$', 'Interpreter', 'latex', 'fontsize', 18)
axis tight
view(-10, 70)
set(gca,'fontsize', 18,'FontName','times')
</pre><pre class="language-matlab">%%
R1 = -5; R2 = 5;
dxo = 0.5; dxn = 0.1;
</pre><pre class="language-matlab">xnew = [x_min:dxo:R1, R1+dxn:dxn: R2, R2+dxo:dxo:x_max]';
</pre><pre class="language-matlab">%%
eta1n = P1*(sech(Q1*(xnew - x1))).^2; % soliton
eta2n = 2*P1*Q1*R1*(sech(Q1*(xnew - x1))).^2.*tanh(Q1*(xnew - x1));
</pre><pre class="language-matlab">%%
figure;
plot(xnew, eta1n, 'k*-', 'markersize', 3)
hold on
plot(xnew, eta2n, 'ro-', 'markersize', 3)
hold on
xlabel('$x$', 'Interpreter', 'latex', 'fontsize', 18)
ylabel('$\eta_2$', 'Interpreter', 'latex', 'fontsize', 18)
axis tight
% ylim([-0.1 0.1])
set(gca,'fontsize', 18,'FontName','times')
</pre><pre class="language-matlab">%%
N1n = (R1 - x_min)/dxo + (R2 - R1)/dxn + (x_max - R2)/dxo + 1;
u_new = zeros(N1n, N2);
x_ax = u_new;
R1 = -5; R2 = 5;
dxo = 0.5; dxn = 0.1;
</pre><pre class="language-matlab">for n2 = 1:N2
</pre><pre> x_ax(:, n2) = [x_min:dxo:R1 + 5*dt*(n2-1), R1+5*dt*(n2-1)+dxn:dxn: R2+5*dt*(n2-1), ...
R2+dxo+5*dt*(n2-1):dxo:x_max]';</pre><pre> u_new(:, n2) = P1*(sech(Q1*(x_ax(:, n2) - R1*t(n2) - x1))).^2 ;
end</pre><p>If you process it you can find a soliton which looks likes a bell.
I want to make the mesh as attached figure.
That is, in the region [R1, R2], the mesh is finer than that of outside one and it moves according to the moving solitary wave.
I want to concentrate only on the significant region.</p><p>I hope to plot it as Figure 1 however I can't, so I hope you help me to improve it.
I'm looking forward to hearing from you..^^</p>Jinsoohttps://www.mathworks.com/matlabcentral/profile/authors/3969943-jinsootag:www.mathworks.com,2005:Question/3260232017-02-20T20:00:22Z2017-02-21T20:00:46ZHow to pass a variable from one file to another?<p>Hi all,
I have a matlab function block in Simulink with a feedback. The input to the function is a constant that changes with the time. The function calls another function includes ode15s (File1) that must get their equations from another file (File2). I want to pass the value of B from the main matlab function file to File2 to be used there.
I used global but that did not work. Any idea?</p><p>Matlab Function File:</p><pre class="language-matlab">function y = fcn(B)
...
y=File1
%-----------------------------
</pre><p>File 1</p><pre class="language-matlab">function [t,x]=File1
....
[t,x] = ode15s(@File2,tspan,x0,opt);
%-----------------------------------
</pre><p>File2</p><pre class="language-matlab">function out= File2(t,x)
...
out=[some equations that use "B" as a constant]
%-----------------------------------------------------
</pre><img src = "/matlabcentral/answers/uploaded_files/70389/xx.png">Ismaelhttps://www.mathworks.com/matlabcentral/profile/authors/1344148-ismaeltag:www.mathworks.com,2005:Question/3262172017-02-21T18:27:06Z2017-02-21T20:21:04ZHow can i write a code to check the abnormality for example for the heratrate by using ECG sensor , and for EDA sensor , and EMG sensor? <p>I'm working in a project and I need to know if there is a template for abnormality of the sensors ? or I should write a code and how can i write it .</p>rahaf alenezihttps://www.mathworks.com/matlabcentral/profile/authors/9718557-rahaf-alenezitag:www.mathworks.com,2005:Question/3262312017-02-21T19:39:52Z2017-02-21T19:51:47Zchange to user directory<p>I have two computers, one with the "user directory" of "C:\Users\fullname\Documents" and the other "C:\Users\partialname\OneDrive\Documents". I have a script that I would like to be able to run on both computers, and not need to change. I would like to be able to have the script save my output file to "C:\Users\somename\Documents\GMAT", but since the user directory is different for both computers, I'm not sure how to do this without changing my user directories.</p><p>Suggestions? Thoughts?</p><p>Thanks.</p>Paul Huterhttps://www.mathworks.com/matlabcentral/profile/authors/8509391-paul-hutertag:www.mathworks.com,2005:Question/3248562017-02-14T00:17:21Z2017-02-21T19:50:55ZHow do I multiply square matrices with symbolic elements representing smaller square matrices in Matlab or muPad? (non-commutative multiplication of symbols)<p>I have several square matrices with symbolic elements. Each element represents a square matrix of the same size. I would like to be able to multiply the larger matrices and maintain the order of multiplication of the elements inside. For instance:</p><pre class="language-matlab">syms a11 a12 a21 a22 b11 b12 b21 b22 real % all of these elements represent matrices
A = [a11 a12; a21 a22];
B = [b11 b12; b21 b22];
</pre><p>I would like to multiply B*A such that I get the response</p><pre class="language-matlab">B*A = [b11*a11 + b12*a21, b11*a12 + b12*a22; b21*a11 + b22*a21, b21*a12 + b22*a22];
</pre><p>where the order of multiplication is maintained.</p><p>I realize that basic Matlab doesn't support non-commutative multiplication, but it looks like there is probably a way to do this in MuPAD by overloading the _mult() operator, but I don't know how to do this.</p><p><a href = "https://www.mathworks.com/help/symbolic/mupad_ref/_mult.html#stdlib-_mult-ex4">https://www.mathworks.com/help/symbolic/mupad_ref/_mult.html#stdlib-_mult-ex4</a>
"Via overloading, the user can implement a non-commutative product for special domains."</p><p>Any assistance would be greatly appreciated!</p>Bad@nicknameshttps://www.mathworks.com/matlabcentral/profile/authors/6676748-bad-nicknamestag:www.mathworks.com,2005:Question/3262152017-02-21T18:07:07Z2017-02-21T19:49:16ZKeep only certain rows based in three column values<p>Hi everyone!</p><p>I have been trying to solve this issue, but I have no identified the workaround!</p><p>From the next data set:</p><pre> YEAR MONTH DAY HOUR MINUTE SECOND WIND DIRECTION (DEGREES)
2009 1 1 0 0 0 20
2009 1 1 0 10 0 21
2009 1 1 0 20 0 24
2009 1 1 0 30 0 29
2009 1 1 0 40 0 30
2009 1 1 0 50 0 28
2009 1 1 1 0 0 24
2009 1 1 1 10 0 31
2009 1 1 1 20 0 27
2009 1 1 1 30 0 25
2009 1 1 1 40 0 29
2009 1 1 1 50 0 31
2009 1 1 2 0 0 30
2009 1 1 2 10 0 30
2009 1 1 2 20 0 25
2009 1 1 2 30 0 27
2009 1 1 2 40 0 18
2009 1 1 2 50 0 27
2009 1 1 3 0 0 27
2009 1 1 3 10 0 29
2009 1 1 3 20 0 29
2009 1 1 3 30 0 30
2009 1 1 3 40 0 30
2009 1 1 3 50 0 30
2009 1 1 4 0 0 34
2009 1 1 4 10 0 38
2009 1 1 4 20 0 43
2009 1 1 4 30 0 57
2009 1 1 4 40 0 79
2009 1 1 4 50 0 72
2009 1 1 5 0 0 65
2009 1 1 5 10 0 64
2009 1 1 5 20 0 59
2009 1 1 5 30 0 56
2009 1 1 5 40 0 51
2009 1 1 5 50 0 51
2009 1 1 6 0 0 67
2009 1 1 6 10 0 60
2009 1 1 6 20 0 61
2009 1 1 6 30 0 78
2009 1 1 6 40 0 82
2009 1 1 6 50 0 88
2009 1 1 7 0 0 87
2009 1 1 7 10 0 85
2009 1 1 7 20 0 96
2009 1 1 7 30 0 92
2009 1 1 7 40 0 99
2009 1 1 7 50 0 108
2009 1 1 8 0 0 123
2009 1 1 8 10 0 118
2009 1 1 8 20 0 101
2009 1 1 8 30 0 99
2009 1 1 8 40 0 108
2009 1 1 8 50 0 105
2009 1 1 9 0 0 104
2009 1 1 9 10 0 105
2009 1 1 9 20 0 101
2009 1 1 9 30 0 95
2009 1 1 9 40 0 96
2009 1 1 9 50 0 101
2009 1 1 10 0 0 96
2009 1 1 10 10 0 113
2009 1 1 10 20 0 126
2009 1 1 10 30 0 107
2009 1 1 10 40 0 105
2009 1 1 10 50 0 88
2009 1 1 11 0 0 86
2009 1 1 11 10 0 72
2009 1 1 11 20 0 72
2009 1 1 11 30 0 70
2009 1 1 11 40 0 79
2009 1 1 11 50 0 81
2009 1 1 12 0 0 90
2009 1 1 12 10 0 101
2009 1 1 12 20 0 106
2009 1 1 12 30 0 100
2009 1 1 12 40 0 102
2009 1 1 12 50 0 93
2009 1 1 13 0 0 96
2009 1 1 13 10 0 91
2009 1 1 13 20 0 97
2009 1 1 13 30 0 100
2009 1 1 13 40 0 94
2009 1 1 13 50 0 101
2009 1 1 14 0 0 86
2009 1 1 14 10 0 86
2009 1 1 14 20 0 88
2009 1 1 14 30 0 87
2009 1 1 14 40 0 93
2009 1 1 14 50 0 98
2009 1 1 15 0 0 92
2009 1 1 15 10 0 92
2009 1 1 15 20 0 79
2009 1 1 15 30 0 79
2009 1 1 15 40 0 85
2009 1 1 15 50 0 89
2009 1 1 16 0 0 95
2009 1 1 16 10 0 84
2009 1 1 16 20 0 79
2009 1 1 16 30 0 75
2009 1 1 16 40 0 86
2009 1 1 16 50 0 79
2009 1 1 17 0 0 97
2009 1 1 17 10 0 84
2009 1 1 17 20 0 67
2009 1 1 17 30 0 72
2009 1 1 17 40 0 80
2009 1 1 17 50 0 89
2009 1 1 18 0 0 106
2009 1 1 18 10 0 21
2009 1 1 18 20 0 29
2009 1 1 18 30 0 320
2009 1 1 18 40 0 315
2009 1 1 18 50 0 319
2009 1 1 19 0 0 325
2009 1 1 19 10 0 323
2009 1 1 19 20 0 330
2009 1 1 19 30 0 332
2009 1 1 19 40 0 325
2009 1 1 19 50 0 328
2009 1 1 20 0 0 330
2009 1 1 20 10 0 328
2009 1 1 20 20 0 333
2009 1 1 20 30 0 331
2009 1 1 20 40 0 341
2009 1 1 20 50 0 338
2009 1 1 21 0 0 340
2009 1 1 21 10 0 341
2009 1 1 21 20 0 350
2009 1 1 21 30 0 348
2009 1 1 21 40 0 354
2009 1 1 21 50 0 350
2009 1 1 22 0 0 358
2009 1 1 22 10 0 353
2009 1 1 22 20 0 359
2009 1 1 22 30 0 354
2009 1 1 22 40 0 2
2009 1 1 22 50 0 8
2009 1 1 23 0 0 3
2009 1 1 23 10 0 14
2009 1 1 23 20 0 13
2009 1 1 23 30 0 15
2009 1 1 23 40 0 20
2009 1 1 23 50 0 17</pre><p>It is necessary to conserve only the data recorded by the instrument exactly every three hours, as it is indicated below:</p><pre class="language-matlab">YEAR MONTH DAY HOUR MINUTE SECOND WIND DIRECTION (DEGREES)
2009 1 1 0 0 0 20
2009 1 1 3 0 0 27
2009 1 1 6 0 0 67
2009 1 1 9 0 0 104
2009 1 1 12 0 0 90
2009 1 1 15 0 0 92
2009 1 1 18 0 0 106
2009 1 1 21 0 0 340
</pre><p>Thanks in advance for your support!</p><p>Best,</p><p>Miguel</p>Miguel Lhttps://www.mathworks.com/matlabcentral/profile/authors/6796184-miguel-ltag:www.mathworks.com,2005:Question/3262332017-02-21T19:47:59Z2017-02-21T19:47:59ZMaximum Simulink realtime model size<p>Dear all</p><p>I'm trying to upload a 300MB dlm file to SLRT target machine but it is failing with an "out of uncommitted memory error 14" error, though I have 4GB of RAM on the target (SLRT OS detects and uses 2848 MB of RAM)</p><p>Is there a limit on the size of Simulink real-time target model? Please note I'm not using the stand-alone mode, so that 16MB model limit does not apply</p><p>Regards,</p><p>MTA</p>MTAhttps://www.mathworks.com/matlabcentral/profile/authors/3225858-mtatag:www.mathworks.com,2005:Question/3262322017-02-21T19:46:58Z2017-02-21T19:46:58ZTransform Linear Filter to System Identification "sys" object<p>I wish to create a System Identification Toolbox "sys" object so I can then calculate the time-domain step response. For example, how do I translate an "s-domain" butterworth filter to "sys" form:</p><p>[zb,pb,kb] = butter(8,2*pi*100e3,'s')
... or
[b,a] = butter(8,2*pi*100e3,'s')</p>John Kingmanhttps://www.mathworks.com/matlabcentral/profile/authors/4578010-john-kingmantag:www.mathworks.com,2005:Question/3261822017-02-21T15:54:07Z2017-02-21T19:46:39ZWhy Index exceeds matrix dimensions. ?? I want to create matrix 3x3 kernel<p>I want to create matrix 3x3 kernel for evaluate of each kernel in image</p><p>for i = 2:r</p><pre class="language-matlab">for j = 2:c
K = IY(((i-1):(i+1)),((j-1):(j+1)));
center = IY(i,j);
B(i,j) = std2(K);
end
end
</pre><p>Index exceeds matrix dimensions.</p><p>Error in test2 (line 23)</p><p>K = IYdouble(((i-1):(i+1)),((j-1):(j+1)));</p><p>Could you show me an example please
thank you</p>Irin Panmookhttps://www.mathworks.com/matlabcentral/profile/authors/8726110-irin-panmook