https://kr.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — 새 질문2021-03-01T04:51:30Ztag:kr.mathworks.com,2005:Question/7590642021-03-01T04:28:33Z2021-03-01T04:51:30ZProblem with try/catchHi all,
I am experiencing a problem with the try/catch function. When I run the below script:
x=1:1:10;
for i=1:length(x)
try
if (x(i)==5)
disp('Success');
end
catch
disp('Dot index error');
continue
end
end
I am only getting a single output corresponding to the part when x(i)==5. Its not displaying the "Dot index error" for other values. I am not sure where I am doing wrong.
I looked into this similar post - https://www.mathworks.com/matlabcentral/answers/108074-try-catch-problems-with-matlab-2013 but that didnt have any follow up answers.
Thank you your help.
Mahith Madhana Kumarhttps://kr.mathworks.com/matlabcentral/profile/authors/16748898tag:kr.mathworks.com,2005:Question/7590742021-03-01T04:47:42Z2021-03-01T04:47:42ZHow to solve this equation in matlab?suriyaprasanth shttps://kr.mathworks.com/matlabcentral/profile/authors/15723191tag:kr.mathworks.com,2005:Question/7580642021-02-27T17:43:26Z2021-03-01T04:39:59ZHow can I keep peak dataHow can I keep the blue dot data into variable to use it on other step?
Thx for all answerPhudit Kanittasuthttps://kr.mathworks.com/matlabcentral/profile/authors/19618179tag:kr.mathworks.com,2005:Question/5185842020-04-17T05:21:40Z2021-03-01T04:30:23ZHow do I install on Ubuntu? I am a novice Ubuntu user, I know how to use Terminal. I am trying to install MATLAB 2020a on my Ubuntu machine, I have downloaded the Linux Installer which is a zip folder. What do I do from here? Thanks! John Griffinhttps://kr.mathworks.com/matlabcentral/profile/authors/13983657tag:kr.mathworks.com,2005:Question/7590692021-03-01T04:30:22Z2021-03-01T04:30:22ZHelp on matlab code neededI want a contour plot for the intensity equation shown below:
I(x,phi) = 2 + 2*cos(m*phi - b*x), where b = 0.1*k, k =2*pi/lambda, m = 2, and phi is phase.
The outcome of the contour plot shoud be as shown below.
Thank you. Emma K.https://kr.mathworks.com/matlabcentral/profile/authors/13131373tag:kr.mathworks.com,2005:Question/3476962017-07-07T04:00:00Z2021-03-01T04:27:20ZWhy cannot I obtain Levenberg-Marquardt as the default Algorithm for 'fit'?According to https://www.mathworks.com/help/curvefit/fit.html?lang=en%C2%A0
"Input Arguments > Name-Value Pair Arguments > Nonlinear Least-Squares Options > Algoritm"
the default is 'Levenberg-Marquardt'.
However 'Trust-Region' is displayed by 'fitoptions' instead.
Why is this happening ('Levenberg-Marquardt' is being changed to 'Trust-Region')?
>> ft = fittype('10^(a*x+b)');
ans = fit(X,Y,ft,'StartPoint',[p(1),p(2)]);
>> fitoptions(ft)
Normalize: 'off'
Exclude: []
Weights: []
Method: 'NonlinearLeastSquares'
Robust: 'Off'
StartPoint: [1x0 double]
Lower: [1x0 double]
Upper: [1x0 double]
Algorithm: 'Trust-Region'
DiffMinChange: 1.0000e-08
DiffMaxChange: 0.1000
Display: 'Notify'
MaxFunEvals: 600
MaxIter: 400
TolFun: 1.0000e-06
TolX: 1.0000e-06 MathWorks Support Teamhttps://kr.mathworks.com/matlabcentral/profile/authors/4622813tag:kr.mathworks.com,2005:Question/7590592021-03-01T04:26:08Z2021-03-01T04:26:08ZWhy support vectors values are negative using regression learner app?Trained model from regression learner app (Gaussian regression) provides some negative value of support vectors. Why is it happening?Manoj kumar Beriyahttps://kr.mathworks.com/matlabcentral/profile/authors/14754180tag:kr.mathworks.com,2005:Question/3707452017-12-03T14:35:16Z2021-03-01T04:18:12ZHow to detect boundaries of a plant's leaves in an image?I need to detect boundaries of a plant's leaves in an image. But i dont know where to start and which way i should follow.Halil Ibrahim Bozogluhttps://kr.mathworks.com/matlabcentral/profile/authors/11404165tag:kr.mathworks.com,2005:Question/7499242021-02-19T06:09:13Z2021-03-01T04:13:55ZHow to linearly fit a semilog graphHello
I have my data file which is attached below. I have to plot this as semilog ( log scale on Y-axis) and have to linearly fit like the image attached. Please help me with the sameSonia Goyalhttps://kr.mathworks.com/matlabcentral/profile/authors/11037994tag:kr.mathworks.com,2005:Question/7590542021-03-01T03:59:01Z2021-03-01T03:59:01ZArray indices must be positive integers or logical values.I am so confused why would I get this error. One minute the code is running fine and produces plots, the next is no longer running. What is the problem with the function Rho? I cleared my workspace multiple times in case something was stuck there but still I am getting the same error. The code was working fine before.
Error message:
Array indices must be positive integers or logical values.
Error in Rho (line 35)
rho(1) = rho(1)+ q*(x_p(i) - x(end-1))/(dx^2); % rhoj
Error in WeakBeam (line 157)
[rho] = Rho(rhoe, xe, x, dx, qe);
I will be posting the code as well for you to run. Lujain Almarhabihttps://kr.mathworks.com/matlabcentral/profile/authors/12080112tag:kr.mathworks.com,2005:Question/7589492021-03-01T01:50:29Z2021-03-01T03:58:06ZMatlab Grader and resample()I am trying to use matlab grader with a script that uses the resample function.
The documentation online indicates some aspects of the signal processing toolbox are not available.... but resample() is not mentioned.
Any suggestions appreciated.
Thanks
The code below - copied from a mathworks website -
fs = 10;
t1 = 0:1/fs:1;
x = t1;
y = resample(x,3,2);
t2 = (0:(length(y)-1))*2/(3*fs);
plot(t1,x,'*',t2,y,'o')
xlabel('Time (s)')
ylabel('Signal')
legend('Original','Resampled', 'Location','NorthWest')
causes the following error.
Undefined function 'resample' for input arguments of type 'double'. Error in solution (line 4) y = resample(x,3,2);
Greg Watkinshttps://kr.mathworks.com/matlabcentral/profile/authors/10740913tag:kr.mathworks.com,2005:Question/7589692021-03-01T02:25:13Z2021-03-01T03:53:50ZUpdate on filtering tableI posted a question on here the other day about filtering and it hasn't been answered yet, i made some changes to it but still have issue so I'm hoping if there are two posts one will be answered. So i made the loop to store which rows have values over the cut off value, the only problem is when row is under the cut off value a zero is put into the rows delt vector which screws up the deleteing of rows since the Table cannot have a zero input.
Filter=app.CutOffValueEditField.Value;
n=size(app.t,1);
if(app.LowPassButton.Value)
for i=1:n
if app.UITable3.Data(i,app.ColumnNumberbeingevalulatedEditField.Value)>=Filter
rowsdelt(i)=i
end
end
app.UITable3.Data(rowsdelt,:)=[];Kyle Koutonenhttps://kr.mathworks.com/matlabcentral/profile/authors/13534632tag:kr.mathworks.com,2005:Question/7590442021-03-01T03:52:06Z2021-03-01T03:53:24ZCalling elements of a row vector in Loop functionHi, I have the following code where I want to call elements of vector z to in the loop environment. However, i am unable to save the results in each iteration and print it accordingly. My code is as follows;
z = 0:0.01:0.1; % Create a sequence
b =[10;20]; % column vector
x=zeros(1,numel(z)); % preallocate for element of interest
A=zeros (1,numel(z)); % preallocate for element of result
invA=zeros (1,numel(z)); % preallocate for element of result
for k=1:numel(z)
A(k) = [2+z(k) 2.5; 2.5 3+z(k)] ; % matrix of 2*2 with elements depend on value of elements called from z vector
invA(k) = inv(A(k));
x(k) = invA(k)*b;
end
I am getting the following error, "Unable to perform assignment because the left and right sides have a different number of elements." I dont know how to resolve this issue in this context. I require the print of all these three elements of interest along with corresponding z values used. Any help is appreciated. Muhammad Arslan Iqbalhttps://kr.mathworks.com/matlabcentral/profile/authors/17746693tag:kr.mathworks.com,2005:Question/7590492021-03-01T03:52:48Z2021-03-01T03:52:48Zchange Matlab code to Python in LSTM and Deep LearningI have a Matlab code for audio classification by using LSTM in Matlab which I need to impelent or convert to Python
Here is the code that I need to imoplement in Python ?
How can I convert it Do you have any suggestion for data importing part as well as applying LSTM?
clear all
close all
TrainRatio=0.1;
ValidationRatio=0.1;
folder='/Users/pooyan/Desktop/cmms/class/normal/'; % change this path to your normal data folder
audio_files=dir(fullfile(folder,'*.ogg'));
nfileNum=length(audio_files);
nfileNum=1000
normal=[];
for i = 3600:4599
normal_name = [folder audio_files(i).name];
normal(i-3599,:) = audioread(normal_name);
end
normal=normal';
nLabels = repelem(categorical("normal"),nfileNum,1);
folder='/Users/pooyan/Desktop/cmms/class/anomaly/'; % change this path to your anomaly data folder
audio_files=dir(fullfile(folder,'*.ogg'));
afileNum=length(audio_files);
afileNum=100
anomaly=[];
for i = 1:afileNum
anomaly_name = [folder audio_files(i).name];
anomaly(i,:) = audioread(anomaly_name);
end
anomaly=anomaly';
aLabels = repelem(categorical("anomaly"),afileNum,1);
% randomize the inputs if necessary
% normal=normal(:,randperm(nfileNum, nfileNum));
% anomaly=anomaly(:,randperm(afileNum, afileNum));
nTrainNum = round(nfileNum*TrainRatio);
aTrainNum = round(afileNum*TrainRatio);
nValidationNum = round(nfileNum*ValidationRatio);
aValidationNum = round(afileNum*ValidationRatio);
audioTrain = [normal(:,1:nTrainNum),anomaly(:,1:aTrainNum)];
labelsTrain = [nLabels(1:nTrainNum);aLabels(1:aTrainNum)];
audioValidation = [normal(:,nTrainNum+1:nTrainNum+nValidationNum),anomaly(:,aTrainNum+1:aTrainNum+aValidationNum)];
labelsValidation = [nLabels(nTrainNum+1:nTrainNum+nValidationNum);aLabels(aTrainNum+1:aTrainNum+aValidationNum)];
audioTest = [normal(:,nTrainNum+nValidationNum+1:end),anomaly(:,aTrainNum+aValidationNum+1:end)];
labelsTest = [nLabels(nTrainNum+nValidationNum+1:end); aLabels(aTrainNum+aValidationNum+1:end)];
fs=44100;
% Create an audioFeatureExtractor object
%to extract the centroid and slope of the mel spectrum over time.
aFE = audioFeatureExtractor("SampleRate",fs, ... %Fs
"SpectralDescriptorInput","melSpectrum", ...
"spectralCentroid",true, ...
"spectralSlope",true);
featuresTrain = extract(aFE,audioTrain);
[numHopsPerSequence,numFeatures,numSignals] = size(featuresTrain);
numHopsPerSequence;
numFeatures;
numSignals;
%treat the extracted features as sequences and use a
%sequenceInputLayer as the first layer of your deep learning model.
featuresTrain = permute(featuresTrain,[2,1,3]); %permute switching dimensions in array
featuresTrain = squeeze(num2cell(featuresTrain,[1,2]));%remove dimensions
numSignals = numel(featuresTrain); %number of signals of normal and anomalies
[numFeatures,numHopsPerSequence] = size(featuresTrain{1});
%Extract the validation features.
featuresValidation = extract(aFE,audioValidation);
featuresValidation = permute(featuresValidation,[2,1,3]);
featuresValidation = squeeze(num2cell(featuresValidation,[1,2]));
%Define the network architecture.
layers = [ ...
sequenceInputLayer(numFeatures)
lstmLayer(50,"OutputMode","last")
fullyConnectedLayer(numel(unique(labelsTrain))) %%labelTrain=audio
softmaxLayer
classificationLayer];
%To define the training options
options = trainingOptions("adam", ...
"Shuffle","every-epoch", ...
"ValidationData",{featuresValidation,labelsValidation}, ... %%labelValidatin=audioValidation
"Plots","training-progress", ...
"Verbose",false);
%To train the network
net = trainNetwork(featuresTrain,labelsTrain,layers,options);
%Test the network %10 preccent
%classify(net,permute(extract(aFE,audioTest),[2 257 35]))
TestFeature=extract(aFE, audioTest);
for i=1:size(TestFeature, 3)
TestFeatureIn = TestFeature(:,:,i)';
classify(net,TestFeatureIn)
predict(i) = classify(net,TestFeatureIn);
end
plotconfusion(labelsTest,predict')
Pooyan Mobtahejhttps://kr.mathworks.com/matlabcentral/profile/authors/18756774tag:kr.mathworks.com,2005:Question/7574342021-02-26T21:24:31Z2021-03-01T03:50:18ZCan I call my .m file code which is in regard with Deep Learning and applying LSTM?I want to use my code for LSTM and audio classification in Python. Can I use that directly without the need to write the code from scrarch in Python?
If there is anyway to call my .m file in Pyhton please let me know step by step.
ThanksPooyan Mobtahejhttps://kr.mathworks.com/matlabcentral/profile/authors/18756774tag:kr.mathworks.com,2005:Question/7590392021-03-01T03:38:48Z2021-03-01T03:49:09ZFigure axis: How can I change '0 1 2 3' into '0.0 1.0 2.0 3.0' while keeping ' x 10^9' on the top of y axis ?Check this figure:
wenhao yanghttps://kr.mathworks.com/matlabcentral/profile/authors/11045198tag:kr.mathworks.com,2005:Question/7590292021-03-01T03:31:12Z2021-03-01T03:41:30ZSelect a random element of a vector and use randi commandWhat command should I use to randomly select an element from a vector and give it a random number by using the randi command while also displaying the other elements in the workspace?Eric Junaeushttps://kr.mathworks.com/matlabcentral/profile/authors/21249843tag:kr.mathworks.com,2005:Question/7555042021-02-25T02:41:13Z2021-03-01T03:38:30ZHow to draw bar graph of different colors ?I have plotted the bar graph but the color is same. i want to differentiate the color of each x variable .Thank you in advance !DEWDROPhttps://kr.mathworks.com/matlabcentral/profile/authors/17087369tag:kr.mathworks.com,2005:Question/7590342021-03-01T03:38:08Z2021-03-01T03:38:08ZHow to make a +5 (or any +number) jump in array values inside a for loop?So when line 0 condition is met, I want the for loop to jump 5 rows from the given data set of a single column. So when count1 ==5 , I want the loop to skip 5 rows from the column and take the 6th element as the new reference. [8,8,8,8,8,9,6,546,6,5,6,4,5,5,5,5,5]. In this dataset, the count value should be 2. Now what the issue is that the code given below does not skip to the 6th reference value to compare the next 5 values. I tried line 1 and 2 but those did not work or have any effect on the code.
count=0;
count1=0;
for i=1:length(data)-4
for j=i+1:i+4
if data(i)~=data(j)
count1=0;
break;
else
count1=count1+1;
end
if count1==5 % line 0
count=count+1;
%data(i,1)=data(i+5,1); //line 1
%data(i)=data(i+5); //line 2
else
continue;
end
end
endKarthik Garimellahttps://kr.mathworks.com/matlabcentral/profile/authors/19624616tag:kr.mathworks.com,2005:Question/7590192021-03-01T03:28:39Z2021-03-01T03:33:56ZHow to define these two functions?I would like to define the following 2 functions
My attempt is
fun = @(a,t) t^(a-1) * exp(-t);
gamma = @(a) integral(@(t) fun, 0, Inf);
GAMMA = @(a,x) integral(@(t) fun, x, Inf);
I don't know where is the problem.Ziyi Gaohttps://kr.mathworks.com/matlabcentral/profile/authors/16408786tag:kr.mathworks.com,2005:Question/7590242021-03-01T03:30:25Z2021-03-01T03:30:25ZReading a text file containing strings and numeric dataHi,
I have a .dat file like this:
Time 0.000000400
154 -1 1.77472 1.34813 0.14000 -0.00418 -0.00188 0.00042
155 -1 0.32897 1.41804 0.14000 0.00034 -0.00181 -0.00068
Time 0.000000500
389 -1 1.28893 1.39899 0.12000 0.00304 -0.00191 -0.00033
Time 0.000000600
512 -1 1.86454 1.13224 0.12000 0.00433 -0.00175 -0.00084
520 -1 0.21448 1.44465 0.12000 -0.00033 -0.00190 0.00037
Time 0.000000800
677 -1 1.14717 1.54507 0.12000 -0.00272 -0.00194 0.00005
692 -1 0.64696 1.33344 0.12000 -0.00145 -0.00188 0.00048
697 -1 0.46609 1.33894 0.12000 -0.00097 -0.00187 0.00050
I only need store the numbers and the digital time into two seperate array.
The number of rows of data at each time is not the same, but the number of columns is the same.
Final arrays should look like this:
For numerical data:
154 -1 1.77472 1.34813 0.14000 -0.00418 -0.00188 0.00042
155 -1 0.32897 1.41804 0.14000 0.00034 -0.00181 -0.00068
389 -1 1.28893 1.39899 0.12000 0.00304 -0.00191 -0.00033
512 -1 1.86454 1.13224 0.12000 0.00433 -0.00175 -0.00084
520 -1 0.21448 1.44465 0.12000 -0.00033 -0.00190 0.00037
677 -1 1.14717 1.54507 0.12000 -0.00272 -0.00194 0.00005
692 -1 0.64696 1.33344 0.12000 -0.00145 -0.00188 0.00048
697 -1 0.46609 1.33894 0.12000 -0.00097 -0.00187 0.00050
For digital time:
0.000000400
0.000000500
0.000000600
0.000000800
Total data exceeds 5 million rows, I tried to use xlsread function, but this function is limited to around 1 million rows.
Any help would be appreciated.ZHU QIXUANhttps://kr.mathworks.com/matlabcentral/profile/authors/10869624tag:kr.mathworks.com,2005:Question/7533192021-02-23T03:12:49Z2021-03-01T03:30:16ZCode generation for Mixed-integer linear programming (MILP) algorithmsI'd like to deploy mixed-integer linear programming (MILP) algorithm to embedded targets, however, the built-in MATLAB function intlinprog (Mixed-integer linear programming (MILP) - MATLAB intlinprog (mathworks.com)) doesn't support C code generation by MATLAB coder. Does anybody know any open-source MATLAB implementation of MILP algorithms that may enable me to successfully generate code with minor adaptions? Less advanced algorithms with naive approaches are preferred. Even basic Linear programming code, e.g., only with the simplex method and without support for integer constraints, are acceptable.Yingao Zhanghttps://kr.mathworks.com/matlabcentral/profile/authors/8425658tag:kr.mathworks.com,2005:Question/7505642021-02-19T18:54:15Z2021-03-01T03:26:32ZOffline Update from 2020b Update 4 to Update 5 and BeyondI have an off-line system(s) that was originally installed with 2020b Update 1 using the full 19 GB ISO back in November 2020. Last week I burned a Blu-Ray containing 2020b Update 4 and successfully installed it. I now see 2020b Update 5 is out. My question is: Can I, after extracting 2020b Update 5, copy just the 2020b folder (just the Update 5 specific folder) to my off-line box and install it under the same folder I used for 2020b Update 4? I assume I would need to rename, on the off-line box, the original Update 4 "2020b" folder to R2020b_Update_4 and then replace it with the new Update 5 "R2020b" folder. I want to reduce the overhead of using Blu-Ray disks over DVDs and seems like a waste to copy all these files for each update everytime. Does this make sense? Kenneth Wheelerhttps://kr.mathworks.com/matlabcentral/profile/authors/20089310tag:kr.mathworks.com,2005:Question/7589892021-03-01T02:54:27Z2021-03-01T03:21:20ZHow to classify the dataPlease recommend. I have the machine downtime (minute) data. I would like to classify the critical equipment by used the downtime data for classify (Class A,B,C). What about functions to support this .apinan preehttps://kr.mathworks.com/matlabcentral/profile/authors/19113888tag:kr.mathworks.com,2005:Question/7590142021-03-01T03:17:26Z2021-03-01T03:17:26ZHow to fill the gaps on the boundary surface of the cone using MATLAB?Hi Mathworks community members
I am utilizing the Dr. Bruno Luong's code to fill the gaps. i am using P=[1 2 3; 8 0 4; 7 6 5] to fill the gaps on the boundary surface but some gaps cannot be filled successfuly. using this code, the gaps were filled as 3s. So, i need to adjust the P because its not filling all the gaps. Please anyone can guide me how to overcome this problem.
Aorg = load()
Aorg = s.Aorg;
gapmax = 10;
[m,n] = size(Aorg);
A = double(Aorg>0);
P=[1 2 3;
8 0 4;
7 6 5];
Apad = zeros(m+2,n+2);
maxattempt = 10;
for niter = 1:maxattempt
Apad(2:end-1,2:end-1) = A>0;
B = zeros(m,n,8);
for k=1:8
[i,j] = find(P==k);
B(:,:,k) = Apad(i-2+(2:end-1),j-2+(2:end-1));
end
As = A>0 & sum(diff(B(:,:,[1:8 1]),1,3)==1,3)<=1;
[y,x] = find(As);
if isempty(x)
break
end
p = length(x);
xy = [x,y];
xy1 = reshape(xy,1,[],2);
xy2 = reshape(xy,[],1,2);
d = sum(abs(xy1-xy2),3);
d(d==0) = NaN;
i = (1:size(d,1))';
[dmin,j] = min(d,[],2);
keep = dmin <= gapmax;
i = i(keep);
j = j(keep);
for k=1:length(i)
xyi = xy(i(k),:);
xyj = xy(j(k),:);
dxy = xyi-xyj;
if abs(dxy(1)) > abs(dxy(2))
xr = linspace(xyi(1),xyj(1),abs(dxy(1))+1);
yr = round(interp1([xyi(1),xyj(1)],[xyi(2),xyj(2)],xr));
else
yr = linspace(xyi(2),xyj(2),abs(dxy(2))+1);
xr = round(interp1([xyi(2),xyj(2)],[xyi(1),xyj(1)],yr));
end
A(sub2ind(size(A),yr(2:end-1),xr(2:end-1))) = 3;
end
endM.S. Khanhttps://kr.mathworks.com/matlabcentral/profile/authors/13647580tag:kr.mathworks.com,2005:Question/2829112016-05-06T13:00:29Z2021-03-01T03:14:46ZRoot() in answer of solve functionHello, I am solving a partial derivative equation using symbolic expression. After using f1= diff(f,Qs) and solve(f1,Qs), I got the following answer that have root(....). Anybody can explain to me how can I get rid of root()?
Note: z is not defined initially
Thanks for your help
Example:ans= root(3*a^2*k^2*z^6 - 2*Qn*a^2*k^2*z^5 + 4*a*k*z^5 - 3*Qn^2*a^2*k^2*z^4 + 8*Qn*a*k*z^4,z,1) Linh Danghttps://kr.mathworks.com/matlabcentral/profile/authors/5040812tag:kr.mathworks.com,2005:Question/7589792021-03-01T02:36:25Z2021-03-01T03:13:23ZI need help with running two for loopsSo I have to rewrite a code, I can do it the hard way manually input each sigma value but I prefer to do it more elegantlly ,I want to create a vector with the five values of sigma and create two matrices one for k and c with five columns. The problem I am having is that it is running through first iteration j=1 , but not running after that. This is what I have so far.
% Parameter values
A = 1;
alpha = .3;
beta = 0.96;
delta = 0.08;
lambda = .1;
%sigma = 1.01;%
sigma=[01,1.01,2,3,4];
% Steady state
kss = (1/(A*alpha)*(1/beta-(1-delta)))^(1/(alpha-1));
css = A*kss^alpha-delta*kss;
% Initial stock of capital
k0 = lambda*kss;
% Number of periods
T = 200;
% Initialize vectors
c = zeros(T,length(sigma));
k = zeros(T,length(sigma));
% Pick range for c in first period
cmin = 0;
cmax = A*k0^alpha+(1-delta)*k0;
for j=1:length(sigma)
% Guess that c(1) will be the average of the cmax and cmin
c(1,j) = (cmax+cmin)/2;
% Populate the capital stock in period 1
k(1,j) = k0;
end
% Technical parameters
tol = 1e-5;
dif = 1;
for j=1:length(sigma)
while dif > tol
for t = 2:T
k(t,j) = A*k(t-1,j).^alpha + (1-delta).*k(t-1,j) - c(t-1,j); % Given c(t-1), compute k(t) from feasibility
c(t,j) = (beta.*c(t-1,j)^sigma(j).*(alpha.*A*k(t,j).^(alpha-1)+1-delta))^(1/sigma(j)); % Given c(t-1), compute c(t) from Euler
if (k(t,j)<k(t-1,j)) % If k starts dropping, then the guess for c(2) was too high. Reduce it.
cmax = c(1,j); % Reduce upper bound for c(1) to what we chose before
c(1,j) = (cmax+cmin)/2;% New choice for c(1)
break % Exit the for loop and start again.
elseif k(t,j)>kss% If k becomes larger than kss, then the guess for c(2) was too low. Increase it.
cmin = c(1,j); % Increase lower bound for c(1) to what we chose before
c(1,j) = (cmax+cmin)/2;% New choice for c(1)
break% Exit the for loop and start again.
end
end
dif = abs(max(k(t,j))-kss); % Compute difference between maximum k and kss. If they are close, stop.
end
k(k==0) = max(k(t,j));% The algorithm might stop before we reach period T. In that case, assume we stay at max(k).
endAli Marahttps://kr.mathworks.com/matlabcentral/profile/authors/13386341tag:kr.mathworks.com,2005:Question/386222012-05-17T09:41:27Z2021-03-01T03:12:17ZIf I don't want simulink to generate the file "rtwtypes.h", how can I do?I want use Simulink to generate my control function，but It always to generate at least file: "model.c","model.h" and "rtwtypes.h"；
and the"rtwtypes.h" file looks like that , If I Only want generate two file " model.c" and "model.h "， How can I do？ thanks.
58 typedef int int8_T;
59 typedef unsigned int uint8_T;
60 typedef int int16_T;
61 typedef unsigned int uint16_T;
62 typedef long int32_T;
63 typedef unsigned long uint32_T;
64 typedef float real32_T;
65 typedef double real64_T;wang huahttps://kr.mathworks.com/matlabcentral/profile/authors/1570861tag:kr.mathworks.com,2005:Question/1159372014-02-13T06:08:08Z2021-03-01T03:10:21ZLow Latency Memory Data Transfer between Two MATLAB instances on Two RTLinux OS ComputersHi,
*Does anyone out there have any experience with real time data transfer between two matlab instances on two computers who may suggest the appropriate configuration?*
I'm interested in both the correct use of MATLAB software functions (most likely from Instrument Control Toolbox) and of the best cable connection that optimizes speed and latency of binary data transfers between MATLAB memory's of two RTLinux computers (bandwidth is not an issue as much because the data is not too large that I want to transfer). In other words I'm interested in:
*(1)* the fastest function call to use within MATLAB (e.g. serial(),udp(),..) to transfer binary data in memory from one MATLAB instance on RTLinux Computer #1 to memory of second MATLAB instance on RTLinux Computer #2. I'm assuming this is using Instrument Control Toolbox, but am open to other solutions.
and
*(2)* the fastest cable connection between the two laptops (e.g. thunderbolt (if I use two mac's), firewire, usb3.0, GiGE, Ethernet)
Thank you for your help in advance,
DeborahDeborahhttps://kr.mathworks.com/matlabcentral/profile/authors/2396919tag:kr.mathworks.com,2005:Question/313002012-03-06T04:58:36Z2021-03-01T03:07:47ZTransfer data between two instances of matlabI want to transfer data between two instances of matlab.. How can i do that??Sampath reddyhttps://kr.mathworks.com/matlabcentral/profile/authors/3300971tag:kr.mathworks.com,2005:Question/7590092021-03-01T03:04:08Z2021-03-01T03:04:08ZNot sure if sending serial dataI am trying to send serial data to my arduino, I am not sure if it is receiving it. This is what my code looks like.
clc
clear s
s = serialport("COM4",115200);
text = extractFileText("transition.txt");
write(s,text,"string");
Is there way that I can check to see if the arduino is actually getting the string?Conner Carrierehttps://kr.mathworks.com/matlabcentral/profile/authors/16702520tag:kr.mathworks.com,2005:Question/7590042021-03-01T03:00:54Z2021-03-01T03:00:54ZHow to subscribe topic from gazebo by using the "gazebo subscribe block" in simulinkGazebo (Ubuntu 18.04, gazebo-9) connect Simulink(matlab2020b) correctly!
then i used "gz topic -l", i could see all the topic in gazebo, means the topic have been published.
Connectin between ubuntu and matlab correctly, then i try to follow the tutorial: use "gazebo read block" to read GazeboPlugin msgs, that ok!
but if i use "gazebo subscribe block" , there was no topic that i could choose, when i clic on "select", it shows no topic could subscribe...?
very urgent, please help meto figure out this question!!! Is it the issues of version of ubuntu or gazebo? or code? used google protobuf 3.0.0
thanks in advance !shengqi xuhttps://kr.mathworks.com/matlabcentral/profile/authors/18119349tag:kr.mathworks.com,2005:Question/7589942021-03-01T02:59:15Z2021-03-01T02:59:15ZI want to maximize the figure displayed by ginput.If i run it normally, not maximum size in screen.
Hiroyasu Fujitahttps://kr.mathworks.com/matlabcentral/profile/authors/5654132tag:kr.mathworks.com,2005:Question/7517592021-02-21T14:48:58Z2021-03-01T02:50:56ZHow to set run-time parameter for all simscape(/multibody) blocks in a file?I just realised, by default all simscape (/multibody) blocks' parameters are compile time meaning any changes to any of the blocks' parameters need recompilation of whole model. My model compilation takes about a minute. This hinders leveraging fast-restart and acclerator modes for parameter sweep and optimisation studies. Changing to run-time for every block is laborious. I was wondering if somebody has workaround to set all simscape blocks' parameters in a file to run-time (and change back to compile time)
thanks in advance
krishna tejahttps://kr.mathworks.com/matlabcentral/profile/authors/9088599tag:kr.mathworks.com,2005:Question/7575092021-02-26T22:23:54Z2021-03-01T02:47:24ZODE45 Related Question Hello, I am trying to replicate the attached figure. I am having trouble implenting ode45 in a way that covers a time span of 66 minutes for two equations. The equations are nearly identical except the second is a slighly reduced form of the first. The difference lies in essentially two terms within this function. The first is (P_B - v*t) and the second is (r*v/3). I need (P_B - v*t) to reduce to P_F from the interval 6 to 66 minutes and (r*v/3) to go to zero from the same interval. As you can see in the code I tried breaking these into two seperate parts, however when I combine the results I get slightly different results from the figure. I know the BGI @ 66 minutes from the figure is nearly 15 if not exactly 15. What can I do to combine these two equations such that they are evaluated from their respective intervals (the non-reduced form from 0 to 6 minutes and the reduced form from 6 to 66 minutes)?
clc; clear; close all;
alpha = 0.0125; %Ostwald N2 solubility
D = 2*10^-8; %Diffusion coefficient (cm^2/sec)
h = 3*10^-4; %Bubble thickness (dyne/cm)
H = 2.5*10^8; %Bulk modulus (dyne/cm^2)
P_B = 14.7*6.8947*10^4; %Initial ambient pressure (dyne/cm^2)
P_F = 4.3*6.8947*10^4; %Final ambient pressure (dyne/cm^2)
gamma = 30; %Surface tension (dyne/cm^2)
V_tiss = 1; %Tissue volume (cm^3)
M = H/V_tiss; %Modulus of elasticity (dyne/(cm^2*cm^3))
P_N2o = 11.6*6.8947*10^4; %N2 initial tension (dyne/cm^2)
P_met = 1.76*10^5; %Metabolic gas tension (dyne/cm^2)
r = 0.0003; %Nucleation radius (cm)
t_a = 6*60; %Ascent time
v = (P_B - P_F)/t_a; %Ascent rate
P_N2 = P_N2o-P_N2o*(1-exp(-.00192*120));
tspan = 0:.1:6;
f = P_B - v*tspan;
plot(tspan, f)
tspan = [0 6*60];
r0 = r;
[t,r] = ode45(@(t,r)((-alpha*D/h)*(P_B-v*t+ 2*(gamma/r) + (4/3)*pi*M*r^3 ...
-P_N2 - P_met) + r*v/3)/(P_B-v*t + (4/3)*gamma/r + (8/3)*pi*M*r^3), tspan, r0);
BGI = r/r0;
plot(t/60,BGI)
grid on
xlabel('Time After Ascent (min)')
ylabel('BGI')
ylim([0 16])
tspan = [6*60 66*60];
r0 = r(41);
[t,r] = ode45(@(t,r)((-alpha*D/h)*(P_F + 2*(gamma/r) + (4/3)*pi*M*r^3 ...
-P_N2 - P_met))/(P_F + (4/3)*gamma/r + (8/3)*pi*M*r^3), tspan, r0);
BGI = r/0.0003;
plot(t/60,BGI)
grid on
xlabel('Time After Ascent (min)')
ylabel('BGI')
ylim([0 16])
Ryan Griffithhttps://kr.mathworks.com/matlabcentral/profile/authors/16164871tag:kr.mathworks.com,2005:Question/7589842021-03-01T02:41:53Z2021-03-01T02:41:53ZScrollable Plot in real time from Arduino to MatlabHi,
I meet a problem when plotting data from Arduino to Matlab, where the x axis is increasing continously and cause the compression of plot. I want to let the x axis auto-scroll, something like axis(t,t+dx,y1,y2). I've tried two ways plotting the data, shown below. Is there any other methods to make the x axis auto-scrolling? Thank you in advance!
Method 1
%Method 1
clear all
a = arduino('COM5','ProMini328_5v');
%interv = 10;
passo = 1;
t=1;
x=0;
%while(t<interv)
while(t)
b=a.readVoltage('A3');
x=[x,b];
plot(x);
%axis([0,interv,0,5]);
ylim('auto');
grid
t=t+passo;
drawnow;
end
Method 2
clear all
clc
%User Defined Properties
a = arduino('COM5','ProMini328_5v'); % define the Arduino Communication port
plotTitle = 'Arduino Data Log'; % plot title
xLabel = 'Elapsed Time (s)'; % x-axis label
yLabel = 'Voltage'; % y-axis label
legend1 = 'Optical Channel 1';
legend2 = 'Optical Channel 2';
yMax = 40 %y Maximum Value
yMin = 0 %y minimum Value
plotGrid = 'on'; % 'off' to turn off grid
min = 0; % set y-min
max = 40; % set y-max
delay = .01; % make sure sample faster than resolution
%Define Function Variables
time = 0;
data = 0;
data1 = 0;
data2 = 0;
count = 0;
%Set up Plot
%plotGraph = plot(time,data,'-r' ) % every AnalogRead needs to be on its own Plotgraph
plotGraph1 = plot(time,data1,'-b')
hold on %hold on makes sure all of the channels are plotted
plotGraph2 = plot(time, data2,'-g' )
title(plotTitle,'FontSize',15);
xlabel(xLabel,'FontSize',15);
ylabel(yLabel,'FontSize',15);
legend(legend1,legend2);
axis([yMin yMax min max]);
grid(plotGrid);
tic
while ishandle(plotGraph1) %Loop when Plot is Active will run until plot is closed
%dat = a.analogRead(0)* 0.48875855327; %Data from the arduino
%dat1 = a.analogRead(2)* 0.48875855327;
%dat2 = a.analogRead(3)* 0.48875855327;
dat1 = readVoltage(a,'A2');
dat2 = readVoltage(a,'A3');
count = count + 1;
time(count) = toc;
%data(count) = dat(1);
data1(count) = dat1(1)
data2(count) = dat2(1)
%This is the magic code
%Using plot will slow down the sampling time.. At times to over 20
%seconds per sample!
%set(plotGraph,'XData',time,'YData',data);
set(plotGraph1,'XData',time,'YData',data1);
set(plotGraph2,'XData',time,'YData',data2);
%x = linspace(0,100,10000);
xlim([0 30]);
%xticks('auto');
ylim('auto');
%axis([time(count) time(count)+10 min max]);
%axis([0 time(count) 1 5]);
%xlim([max(0,time(count)-0.1) max(10,time(count)-0.1)]);
%ylim(min,max);
%Update the graph
pause(delay);
end
delete(a);LuYao Guohttps://kr.mathworks.com/matlabcentral/profile/authors/12698681tag:kr.mathworks.com,2005:Question/7589742021-03-01T02:33:03Z2021-03-01T02:33:03ZCreat test from spreadsheet Programmatically in sltest.testmanagerHow can I creat a test template file for specifying date and select What is your System Under Test？a ahttps://kr.mathworks.com/matlabcentral/profile/authors/18217283tag:kr.mathworks.com,2005:Question/7588992021-03-01T00:46:54Z2021-03-01T02:21:16Zsolving integral equation where the unknow is the upper limitI have this function
function H = ICPH(T0,T,A,B,C,D)
syms x
f(x) = A+B*x+C*x^2+D*x^(-2);
H = int(f(x),x,T0,T);
end
this function work fine if I put all numerical values
example
y =8.314* ICPH(298.15, 2066, 43.471, 9.502e-3, 0.0, -0.645e5);
vpa(y,6)
ans
802482.0
however if I put this code
syms T real
g = 802482.0 == 8.314* ICPH(298.15, T, 43.471, 9.502e-3, 0.0, -0.645e5);
h5 = vpa(solve(g,T),6)
h5 = 0.585853
In the above code I was trying to solve for the T.
If I enter T manually i got the right answer put I use solve to find the unknow temperature the answer dont make sence.
h5 should be 2066.
what im doing wrongAhmed Hassanhttps://kr.mathworks.com/matlabcentral/profile/authors/12026972tag:kr.mathworks.com,2005:Question/7589592021-03-01T02:20:14Z2021-03-01T02:20:14ZGaus to conduction LU. Error: Subscripted assignment dimension mismatch.A=[3,-.1,-.2;.1,7,-.3;.3,-.2,10];
[m,n]=size(A); B=zeros(m,n);
for i=1:n
B(i,i)=1;
end
for k=1:n-1
for i=k+1:n
factor(i,k)=A(i,k)/A(k,k);
A(i,k)=0;B(i,k)=factor(i,k);
A(i,k:n)=A(i,k:n)-factor*A(k,k:n);
end
end
Subscripted assignment dimension mismatch.Shin iu Xuehttps://kr.mathworks.com/matlabcentral/profile/authors/6933677tag:kr.mathworks.com,2005:Question/7589392021-03-01T01:47:14Z2021-03-01T02:17:11ZProblem with imresize functionHeres my code, I wasnt having an issue with this until i added the midterm function and all the parameters. When i hardcoded the pictures and numbers i needed it worked perfectly but now it keeps giving me an error on line 3. Im really new to matlab and I dont have an prior programming knowlege so im just generally confused here. Any help?
function [] = midterm(imageFile1,imageFile2, scale, margin)
IM2 = imresize(imageFile2, scale);
IM2(1:margin,:,:) = 255;
IM2(end-margin+1:end,:,:) = 255;
IM2(:,1:margin,:) = 255;
IM2(:,end-margin+1:end,:) = 255;
image(imageFile1)
hold on;
image(2337, 1000, IM2)
endElliot Wylliehttps://kr.mathworks.com/matlabcentral/profile/authors/19236801tag:kr.mathworks.com,2005:Question/7532492021-02-23T01:09:06Z2021-03-01T02:16:41ZImatest esfrChart. Detected gray patches may not be correct. Hi, I'm trying to use the esfrChart() function to analyze a set of images. On roughtly 20% of the images, matlab throws the following error:
Detected gray patches may not be correct. Check if image is valid and consider changing detection sensitivity in case no registration points are provided.
The images are extremely similar. This first image works:
This second one throws the error:
I've tried inputting the registration points myself as well as changing the sensitivity, which didn't help. I also tried cropping the images in case the distortion near the edges was affecting things, but cropping didn't change which images work and don't work either.
What is this verification step where this error is thrown and is there a way around it? Is there anything that could be done when taking the images to make them work better?Sara Nagelberghttps://kr.mathworks.com/matlabcentral/profile/authors/20688879tag:kr.mathworks.com,2005:Question/7587342021-02-28T18:16:14Z2021-03-01T02:14:42Zhow to share the data from one app to another app in matlab app designer I know this question already asked I also going to refference document but the concept is not cleard to me.
please help me to reach out. I explained below what I want.
I have User input promt on which i taken the input as temperature value in 3 numeric EditFeild.
share that 3 numeric edit feild value to another app where another 3 numeric EditField in that I want to show average of all the temperature, maximum and minimum temperature among three .
I have added 1st button to open the 2nd app and 2nd button to get the result in other app.
I think this enough to clear the concept how to share the data from one app to another.
please suggest code for it thank you! Krutik Gujarathihttps://kr.mathworks.com/matlabcentral/profile/authors/18541524tag:kr.mathworks.com,2005:Question/7589542021-03-01T02:06:25Z2021-03-01T02:06:25ZHow to import .txt file and export the data that I wantI need some help to export the data from this .txt file
I can read it with 'readtable(filename)'
But I don't know how to export the data that I want..
For example in the file
I want to read time = 0.001, time = 0.002, time = 0.003 .... time = 0.006
and then I want to save this data from matlab to .dat file승원 이https://kr.mathworks.com/matlabcentral/profile/authors/21233279tag:kr.mathworks.com,2005:Question/7589442021-03-01T01:48:20Z2021-03-01T01:50:26ZHow to write for or while loop along with indexing?Hello Sirs
May I ask your guidance for my study please?
There are three data in my problem (1) months and (2) Demand (3) X for several years.
I need to specify the first X value as SWA and second X value as EWA and third value as HF.
In this sample excel file 2 years data is given. Thus, there will be two SWA, two EWA and two HF.
Then, I need to mulitply the every 12 months Demand data with specific SWA, EWA and HF.
First SWA value (0.0319) should mulitply the demand 1:12 and second SWA value (0.9873) should multiply the demand 13:24 and so on.
First EWA (0.5272) should mulitply with constant value K= 1000 and plus with demand 1:12. Similarly, second EWA (0.0028) should multiply with K=1000 and plus the demand data from 13:24.
%input
clear all;
data=xlsread('data.xlsx');
demand=data(1:24,2);
x=data(1:6,3);
K=1000;
% I used incrementing by 3 to get the SWA , EWA and HF index and value.
SWA_idx=[1:3:6]';SWA_x=x(SWA_idx);
EWA_idx=[2:3:6];EWAx=x(EWA_idx);
HF_idx=3:3:6;HF=x(HF_idx);
%I select demand indexing for months and multiply with relevant SWA value.
y1=demand(1:12).*SWA_x(1);
y2=demand(13:24).*SWA_x(2);
z1=demand(1:12)+K*EWAx(1);
z2=demand(13:24)+K*EWAx(2);
%Now, I have to change everything sentence manually and it is very painful task for many years.
% So I want to use for loop or while loop. But, I don't know how to do it and can you kindly guide me please?
% Thank you very much.soe thihahttps://kr.mathworks.com/matlabcentral/profile/authors/13030378tag:kr.mathworks.com,2005:Question/7589292021-03-01T01:34:16Z2021-03-01T01:48:08ZHow to append values from different files to an array?Hello, I have a script that reads in a signal and finds the mean intensity from it. I have hundreds of these files and each time I run I would like to add the next mean value to an array. The files are CSV's and the code is edited each time to call a new file.
data=load('600-0.csv'); %filename changed every time and ran again
V=data(:,1);
M=mean(V);
% I have tried using this, however this overwrites each time.
mean=[]
mean = [mean; M]
Thank you for help. I have spent a lot of time trying to find a solution before posting here.Fraser Barnardhttps://kr.mathworks.com/matlabcentral/profile/authors/13802309tag:kr.mathworks.com,2005:Question/7589042021-03-01T00:51:20Z2021-03-01T01:43:10ZHelp using symbolic transfer functionI'm trying to use the feedback function to determine the closed loop transfer function of a given system. The system has two variables K1 and K2. The 'G' in the feedback function would be: . I read a ton of posts on here stating that you can't use symbolic variables in the tf function, but I didn't see any one mention a way around it. Here is my code:
syms K1
syms K2
K = 6;
G = tf([K1*K2], [1 -3 -4]);
H1 = feedback(G,K);Mark Cornellhttps://kr.mathworks.com/matlabcentral/profile/authors/16673915tag:kr.mathworks.com,2005:Question/3122182016-11-14T21:04:18Z2021-03-01T01:42:46ZMethods to get ride of Root in solution of solve function<https://www.mathworks.com/matlabcentral/answers/282911-root-in-answer-of-solve-function Related Question>
<- This link shows a related question. I do not understand the accepted solution. I tried to copy and paste using R2016b and exprc was unknown. I tried to replace exprc with orig_expression but the output was still just the root functions.
The solve equation below is taking forever. Solve(...,v_3) (without out 'real' flag) returns 6 root functions. I'm looking for an answer that is only a function of a_1,v_1,A,D.
solve(S == (D*(((A + D)*(a_1^2 - 2*A*v_1 + 2*A*v_3))/D)^(3/2))/(3*(A + D)^3) - (a_1 - (D*(((A + D)*(a_1^2 - 2*A*v_1 + 2*A*v_3))/D)^(1/2))/(A + D))^3/(6*A^2) - (D*(((8*v_3*A^2 + D)/D)^(1/2) - 1)^2)/(8*A^3) - (v_1*(a_1 - (D*(((A + D)*(a_1^2 - 2*A*v_1 + 2*A*v_3))/D)^(1/2))/(A + D)))/A + ((((A + D)*(a_1^2 - 2*A*v_1 + 2*A*v_3))/D)^(1/2)*(- a_1^2 + 2*A*v_1 + 2*D*v_3))/(2*(A + D)^2) + (a_1*(a_1 - (D*(((A + D)*(a_1^2 - 2*A*v_1 + 2*A*v_3))/D)^(1/2))/(A + D))^2)/(2*A^2) + (v_3*(((8*v_3*A^2 + D)/D)^(1/2) - 1)*(A + D))/(2*A^2) - (D*(2*A^2 + D^2)*(((8*v_3*A^2 + D)/D)^(1/2) - 1)^3)/(16*A^5), v_3, 'Real', true)
An Nguyenhttps://kr.mathworks.com/matlabcentral/profile/authors/7710844tag:kr.mathworks.com,2005:Question/5415682020-06-03T18:18:37Z2021-03-01T01:40:47ZNested tables with duplicate sub-column names?I'm trying to create a table that consists of two sub-tables, with different names, each of which is two columns wide. All four sub-columns have the same number of rows. The issue is that the first sub-column in both sub-tables has the same name, and ditto for the second:
----- START ----- ----- STOP -----
Week Seconds Week Seconds
1234 567890 1234 604799
1235 123450 1235 271828
When I try to nest this into a single table, as shown a few of the examples here, I keep getting "Duplicate table variable name: 'Week'."
Of course I could rename the columns as something like "WeekStart", "SecondsStart", etc. to avoid this, but that's a bit awkward—in that case I'd just make a single four-column table, but would lose the nice grouping in the process. I've tried a few of the examples above, as well as mergevars and splitvars, but no luck so far.
Is there a clean way to do this, or is this just not how MATLAB tables are meant to be used? AMMhttps://kr.mathworks.com/matlabcentral/profile/authors/18123668tag:kr.mathworks.com,2005:Question/7589342021-03-01T01:38:59Z2021-03-01T01:38:59ZOptimize the constant by minimizing the error whit no direct relationI want to find the optimised value for the three constant C1, C2, C3 by minimising the error of ErFEM.
I run an ABAQUS job; in the first job, I define C1, C2, C3, and the ABAQUS generates a result, let's name it FEMresutl.
I subtract the FEMresult from the gold standard, and the final result is ErFEM.
ErFEM should become less than 50um by optimising C1, C2, C3.
However, there is no direct relation between the ErFEM and C1, C2, and C3.
How can I write an optimisation code that optimises the C1, C2, C3 by minimising the ErFEM?
ThanksSMhttps://kr.mathworks.com/matlabcentral/profile/authors/10908668tag:kr.mathworks.com,2005:Question/3108152016-11-05T22:12:46Z2021-03-01T01:36:31ZSpecify annotation position with respect to x- and y-axes values? Dear all,
Is there a way the define the starting and end point of an annotation object such as an arrow in terms of the data being plotted and not as either "normalized" coordinates (x- and y-positions between 0 and 1) or a physical length measurement such as cm?
E.g. I am plotting a time from 0 to 180 s on the x-axis and a concentration between 0 and 0.1 concentration units on the y-axis. Now I would like to draw an arrow starting at 90 s, 0.04 concentration units and going to 120 s, 0.09 concentration units.
I have already considered to simply "normalize" those positions myself (e.g. 90 s/180 s = 0.5 --> x-position in normalized coordinates). This does, however, not work, since 0 and 1 refer to points in the whole figure (the window in which the plot appears) and not to the area of the plot itself.
Thanks for any input!
ClemensClemenshttps://kr.mathworks.com/matlabcentral/profile/authors/8274735