https://www.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2021-05-14T23:29:40Ztag:www.mathworks.com,2005:Question/8304032021-05-14T23:29:40Z2021-05-14T23:29:40ZError in my codeCan anyone help i have a gui and implemented a pushe button that allows me to upload and image but everytime i get prompted with files and chose an image i get this errorschadrac Divovahttps://www.mathworks.com/matlabcentral/profile/authors/22169502tag:www.mathworks.com,2005:Question/8303632021-05-14T21:39:25Z2021-05-14T23:23:37ZProblem with matrix function output (Q learning, Calvano et al. 2021)Hello !
I'm currently working on the Q learning algorithm similar to the one presented in Calvano et al. 2021 (AER).
As a part of preliminary work, I want to produce a distribution table similar to the one I attached below.
The idea is simple. I have a function which gives prices and profits for 2 market makers depending on multiple parameters. More particularly, I want it to vary in alpha (2.0:0.1:4.0) and beta (0.04:0.001:0.06) and fix other parameters at the begining. Then, having a matrix of average values (my function 'fn' gives average prices and profits) and using imagesc(), it would be easy to obtain the desired results. The problem is that the code is not working.
Here is what I have at the moment :
beta0=0
n=10000
T=1000
[P,Profit]=fn(2.0:0.1:4.0,0.04:0.001:0.06,beta0,n,T); % I don't know how to index the profits depending on alpha and beta in order to have a clear matrix later.
Matr=append(Profit(:,1)); % Here I put Profit(:,1) because I'm verifying first the profits of the first market maker. But the 'append' function is clearly a wrong idea.
a=(2.0:0.1:4.0)
b=(0.04:0.001:0.06)
imagesc(b, a, Matr);
set(gca, 'YDir', 'normal');
xlabel('beta');
ylabel('alpha');
colorbar
I've already spent hours looking for an answer. It's the first time I use matlab which makes it difficult not only to optimize my code (to make it less time consuming) but also to make it work. I would be very greatful for any help. Thank you !!
Olena Bogdanhttps://www.mathworks.com/matlabcentral/profile/authors/22451742tag:www.mathworks.com,2005:Question/8303882021-05-14T22:53:29Z2021-05-14T23:19:11ZData acquisition toolbox - reading with different ratesHi all,
Let us suppose the following code:
dq = daq("ni");
dq.Rate = 25600; % 25,600 scans per second
ch9234ai0 = addinput(dq, "cDAQ1Mod1", "ai0", "Accelerometer");
ch9234ai0.Sensitivity = 0.0969; % Channel ai0: 96.9 mV/gravity (mV/G)
ch9203ai0 = addinput(dq, "cDAQ1Mod2", "ai0", "Current");
[data9174, startTime9174] = read(dq, seconds(10.0));
the code acquires data from a temperature transducer connected to a NI-9203 module and from an accelerometer connected to a NI-9234 module. Both modules are connected to a NI-9174 cDAQ. The temperature transducer measures the water temperature and the accelerometer measures the vibration in the suction tube of a water turbine. The code reads (read command) data from both devices during 10 seconds at a rate of 25,600 scans per second. So, 256,000 temperature values and 256,000 vibration values will be acquired.
it is worth noticing that the data acquisition toolbox lets me define only one data acquisition rate for the cDAQ, i.e., for all modules connected to the cDAQ. The problem is that there are modules that require high acquisition rates, while for other modules, low acquisition rates are sufficient. In the code, the rate of 25,600 scans per second is suitable for the accelerometer, but is much higher than that that is required for the temperature transducer. This causes a waste of the cDAQ bandwidth.
there are two possible alternatives to work around this shortcoming of the toolbox. The first one is to buy two cDAQs, and put the modules that require high acquisition rates in one cDAQ and the ones that require low acquisition rates in the other cDAQ. The second alternative, I guess, is to remove, for example, the first channel from the cDAQ (removechannel function) and read the data from the second channel and after, remove the second channel, insert the first channel and read data from it. However, this is a bit awkward and causes other problems.
does anyone suggest any other alternative to work around?
I thank you all in advance, cheers, OtavioOtavio Carpinteirohttps://www.mathworks.com/matlabcentral/profile/authors/5463656tag:www.mathworks.com,2005:Question/8301632021-05-14T16:28:40Z2021-05-14T23:17:58ZUnable to save image using a SAVE buttonI have created a matlab GUI where I want to save the processed images using a SAVE button. I am using a slider where I can browse through the processed images. I want to save each image with the SAVE button. Unfortunately, the images are not saved in the correct format(I want to save it in the jpeg format). Any suggestions would be appreciated.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles = guidata(hObject);
filePattern=handles.filePattern;
num_files=handles.num_files;
theFiles=handles.theFiles;
myFolder=handles.myFolder;
value=handles.value;
seg=handles.seg;
% dirName = fullfile(pwd,'Results',myFolder);
% if ~exist(dirName,'dir')
% mkdir(dirName);
% end
[filename, foldername] = uiputfile('D:\regionGrowing_MLT');
complete_name = fullfile(foldername, filename);
imwrite(seg{value}, complete_name,'jpg');
guidata(hObject, handles);
endWarid Islamhttps://www.mathworks.com/matlabcentral/profile/authors/9112730tag:www.mathworks.com,2005:Question/3135142016-11-22T17:12:55Z2021-05-14T23:12:34ZHow to use "imhistmatch" for 3D images?I have two 3D images of different size.
a = 120 x 120 x 80
b = 192 x 192 x 120
how can I use imhistmatch or another method to make the intensity ranges in a and b to be (almost) the same?MLhttps://www.mathworks.com/matlabcentral/profile/authors/6799604tag:www.mathworks.com,2005:Question/8302532021-05-14T18:23:55Z2021-05-14T23:08:21ZWhy is appdesigner toolbar not visible when visible is defined as 'on'?Hello,
I am having trouble with Appdesigner toolbar.
First, is there a way to get it always be visible and not just when you hover over it with your mouse?
Second, despite when I define:
app.UIAxes.Toolbar.Visible = 'on'
the toolbar is not visible. I'm able to interact with it but it just disappears. Is there a fix?Dc215905https://www.mathworks.com/matlabcentral/profile/authors/11207461tag:www.mathworks.com,2005:Question/8303932021-05-14T23:00:00Z2021-05-14T23:00:00ZClassifying grainy and defected marblesHello everyone, i'm trying to classify grainy texture and defects on marbles. The code should understand the differences between grainy textures and cracks.
In the code, it finds all the textures. How can I distinguish cracks from grainy texture. Can anyone help me?
i=imread('image1.jpg');
figure
imshow(i)
title('Original image before processing')
I = rgb2gray(i);
bw = edge(I, 'Canny', 0.27);
figure
imshow(bw)
title('Edges of Original Image Canny Method')
BW_out = bwpropfilt(bw, 'Area', [150 + eps(200), Inf]);
BW_out = bwpropfilt(BW_out, 'Perimeter', [70 + eps(100), Inf]);
properties = regionprops(BW_out, {'Area', 'Eccentricity', 'EquivDiameter', 'EulerNumber', 'MajorAxisLength', 'MinorAxisLength', 'Orientation', 'Perimeter'});
figure
imshow(BW_out)
title('Crack extracted')matlablearnerhttps://www.mathworks.com/matlabcentral/profile/authors/22246964tag:www.mathworks.com,2005:Question/8303032021-05-14T19:38:27Z2021-05-14T22:59:46ZUnable to perform assignment because the left and right sides have a different number of elements. clear
syms X1 X2 X3 X4
xx=[X1,X2,X3,X4]
X1 = xx(1);
d = length(xx);
term1 = (X1-1)^2;
sum = 0;
for ii = 2:d
xi = xx(ii);
xold = xx(ii-1);
new = ii * (2*xi^2 - xold)^2;
sum = sum + new;
end
xc1(1)=1;
xc2(1)=1;
xc3(1)=1;
xc4(1)=1;
err=10^(-2)
%yb4 = @(X1,X2,X3,X4) (term1 + sum)
yb4=(term1+sum)
dyb4_x1=diff(yb4,X1)
dyb4_x2=diff(yb4,X2)
dyb4_x3=diff(yb4,X3)
dyb4_x4=diff(yb4,X4)
J4=[subs(dyb4_x1,[X1,X2,X3,X4],[xc1(1),xc2(1),xc3(1),xc4(1)]) subs(dyb4_x2,[X1,X2,X3,X4],[xc1(1),xc2(1),xc3(1),xc4(1)]) subs(dyb4_x3,[X1,X2,X3,X4],[xc1(1),xc2(1),xc3(1),xc4(1)]) subs(dyb4_x4,[X1,X2,X3,X4],[xc1(1),xc2(1),xc3(1),xc4(1)])]
S4=-(J4)
i=1;
while norm(J4)>err
I4=[xc1(i),xc2(i),xc3(i),xc4(i)]';
syms h;
gr=subs(yb4,[X1,X2,X3,X4],[xc1(i)+h*S4(1),xc2(i)+h*S4(2),xc3(i)+h*S4(3),xc4(i)+h*S4(4)])
dgr_h=diff(gr,h)
h=vpasolve(dgr_h==0,h,[-Inf,Inf])
i=i+1
xc1(i+1)=I4(1)+h*S4(1)
xc2(i+1)=I4(2)+h*S4(2)
xc3(i+1)=I4(3)+h*S4(3)
xc4(i+1)=I4(3)+h*S4(4)
end
Error in dixon (line 38) xc1(i+1)=I4(1)+h*S4(1)alok ranjanhttps://www.mathworks.com/matlabcentral/profile/authors/21927467tag:www.mathworks.com,2005:Question/8302832021-05-14T18:55:41Z2021-05-14T22:54:42ZChecking whether string exist in a cell and read its IDI have a cell array called "proteins_selected" and each row is a code for a protein, looks like this:
Then I would like to translate each protein code into its ID, so i have another cell array "GoAnnotationsWithId" which is like a dictionary(the second row is ID):
So i would like to chech whether proteins from proteins_selected exist in GoAnnotationsWithId file, and get appropriate ID of this protein. I would be extremely grateful for any help. Mhttps://www.mathworks.com/matlabcentral/profile/authors/19876665tag:www.mathworks.com,2005:Question/8303682021-05-14T21:59:52Z2021-05-14T22:49:13ZGive a specific color to an interval of valueHi, i have to plot with pcolor a matrix with values from -1 to 1. How can i assign to the values from -1 to 0.3 a color in grey scale and to the values from 0.3 to 1 a color in green scale? Thank you allGiacomo Abrardohttps://www.mathworks.com/matlabcentral/profile/authors/13995940tag:www.mathworks.com,2005:Question/911592013-10-23T04:40:29Z2021-05-14T22:44:15ZHow do I fit an exponential curve to my data?Say, I have the following data: x=[1,2,4,6,8],y=[100,140,160,170,175]. How do I fit an exponential curve of the form y=a-b*exp(-c*x) to my data? Is there any Matlab function to do that? Thanks in advance.Rinuhttps://www.mathworks.com/matlabcentral/profile/authors/4671340tag:www.mathworks.com,2005:Question/1366122014-06-20T06:08:06Z2021-05-14T22:41:39ZI have segmented a image using region growing. Now i want to count number of pixels in each regions. How can i do that?I have segmented a image using region growing. Now i want to count number of pixels in each regions. How can i do that? i want all the regions which have less than 100 pixels.Purbankanhttps://www.mathworks.com/matlabcentral/profile/authors/2763036tag:www.mathworks.com,2005:Question/8302682021-05-14T18:42:05Z2021-05-14T22:37:36ZHow to get the x axis and y axis to start at 0 when adding regression line in Figure windowHow do I edit the graph to get the x and y axis at 0 to line up at 0 instead of the way it is spaced?
Stephnie Watsonhttps://www.mathworks.com/matlabcentral/profile/authors/9735313tag:www.mathworks.com,2005:Question/8292032021-05-13T14:53:48Z2021-05-14T22:36:08Zcustom deep learning training loop: gradient computation using dlgradientI'm trying to train a CNN with semi supervised learning but i can't evaluate the automatic gradient properly: in particular when i call the function dlgradient (with loss and net.Learnables as parameters) the program invokes other functions inside it and when it's the time of backwardTape (which is also the method that, using other nested functions, is able to compute the gradient) the program fails! it happens that backwardTape is just skipped by the program (actually it gives the output grad, but if i try to step in with the debugger, i can't and it jump to the next line of the code instead); the line is:
grad = backwardTape(tm,{y},{initialAdjoint},x,retainData,false);
in backwardPass.m of the deep learning toolbox. The output grad is just a vector of empty arrays
P.S. the dlnetwork i have created is based on alexnet using transfer learning.
part of the code of interest is:
loss = labeledLoss + unlabeledLoss; %this two statements are inside a training loop
gradients = dlfeval(@computeModelGradients,net,loss);
function gradients = computeModelGradients(network,loss)
gradients = dlgradient(loss,network.Learnables);
end
%where:
%studentNet is a 1x1 dlNetwork of 24 layers (of which 22 are from alexnet
%and the last 2 are a fully connected and a softmax)
%loss is 1x1 dlArray (which contain a double)Niko Picellohttps://www.mathworks.com/matlabcentral/profile/authors/16547761tag:www.mathworks.com,2005:Question/8303832021-05-14T22:20:39Z2021-05-14T22:20:39ZCan someone check this to make sure it makes sense please? Esentially I am trying to get real world locations of an object of a fixed size and shape given a single picture. There are some random numbers I have in there such as the "120" for calibrating because I did the math of how far my camera could pick up the objects as a singluar pixel and I estimated it to be around 120ft. Obviously it couldn't in real life but thats what I used just as a baseline. I was hoping someone could tell me if my code makes sense or it just happens to be somewhat accurate by mistake.
Most notes can be ignored due to me just using them cause im learning as I go, but I left them in for context just in case
Thanks
==============================================================
I = imread('GreenCalibrationX.jpg'); %imagine upload and saves as RGB values
%I = imread('YellowPaperHD.jpg');
%%%%%%%%GreenCalibrationX has a Z direction of 4ft 8in, and an X direction of 2ft 2 in
%%%%%%%%The program outputs a Z distance of 4.3ft and X distance 2.02ft
%I = imrotate(J, -90);
imshow(I) %shows image
%W = imread('yellowdot.jpg'); %Testing Code
[rows, columns, numberOfColorChannels] = size(I); %registers the number of rows and colums of image
YellowPixCount = 0;
r = I(:,:,1); %Places RGB values into a matrix someone dumb like me can manipulate
g = I(:,:,2);
b = I(:,:,3);
%Red= r(58,198); Testing Code
%Gre= g(58,198);
%Blu= b(58,198);
for x = 1:rows; %runs for all rows
x = x+1;
for y = 1:columns; %runs for all column, meaning it hits every pixel
y = y+1;
Red = r(x-1,y-1); %Records RGB values for each pixel temperarily
Gre = g(x-1,y-1);
Blu = b(x-1,y-1);
if Red > 160 & Gre > 190 & Blu < 130 %if pixel matches color criteria
YellowPixCount = YellowPixCount +1; %counts how big the object, hopefully to translate to how far away
LastPixRow = x;
LastPixColumn = y;
if YellowPixCount == 1 %for first pixel that meets color criteria
X1 = x %writes the row and column values of the first succesful pixel
Y1 = y
else
end
else
end
end
end
YellowPixCount; %outputs yellow pixel count
LastPixRow
LastPixColumn
%Area = YellowPixCount %Just redefining; Area based on PixCount; inaccurate
%Dia = 2*(sqrt(YellowPixCount/ pi)) %Diameter based on area seems inaccurate
RowBasedDia = LastPixRow - X1
%NOTE FOR LATER 1/DISTANCE = SIZE, as distance is doubled, size is cut in
%half
ZCalibrationCoef = (columns/2016) %Calibrates pictures that have different Resolutions; Minimum (2016,1512)
DistanceZ = (120*ZCalibrationCoef)/RowBasedDia %CalibratedDistance Z, 190 WAS CHANGED FROM 121!!
XCalibrationCoef = (470/columns);
DistanceX = ((1/150)*((-columns/2)+Y1)*XCalibrationCoef*(DistanceZ/3.5)) %1 foot=150pixels 3.5feet from camera in calibration
YCalibrationCoef = (635/rows);
DistanceY = ((1/150)*((rows/2)-X1)*YCalibrationCoef*(DistanceZ/3.5)) %1 foot=150pixels at 3.5feet from camera in calibration
===========================================================
These are the outputs it gives for this image, they arent perfect but they seem rather close to the real life ones.
DistanceZ =
4.6154 ft
DistanceX =
1.5372 ft
DistanceY =
0.3101 ftZachary Steinwachshttps://www.mathworks.com/matlabcentral/profile/authors/13390954tag:www.mathworks.com,2005:Question/8303432021-05-14T20:48:18Z2021-05-14T22:18:32ZHow to split cell array made by matrix?Hi everyone, i have a cell array made by n matrix ('n' is an input from the user).Every matrix is 3x3. I need to split this cell array in two halfs, how can i do it? I have tried in this way
num=1:1:N_ply;
lx = (length(num));
half = ceil(lx/2);
Q1 = Qk{num(1:half)}
where N_ply=8, and Qk is the cell arrayGiuseppe Marinohttps://www.mathworks.com/matlabcentral/profile/authors/11089353tag:www.mathworks.com,2005:Question/1062642013-11-15T12:44:52Z2021-05-14T22:15:03Zopen/convert WCP data fileHello everyone!
With what function can I open or convert WCP data file from WinWCP program in MatLab?
Thaknk you.olgahttps://www.mathworks.com/matlabcentral/profile/authors/4282497tag:www.mathworks.com,2005:Question/8303732021-05-14T22:07:54Z2021-05-14T22:14:43ZSave Geographic Player Figure as an imageI want to save this image but it is not a normal figure. Could you please help me how I could save it?
player = geoplayer(data.latitude(1),data.longitude(1),zoomLevel);
plotRoute(player,data.latitude,data.longitude);
Dimitrios Pouloshttps://www.mathworks.com/matlabcentral/profile/authors/22550783tag:www.mathworks.com,2005:Question/8303782021-05-14T22:14:37Z2021-05-14T22:14:37ZTD convolution versus FD multiplicationHi all.
I am trying to convolute two time doamin signals. singal 1 is imported to matalb as a FD signal while i am creating signal2 in matlab so i do create it in TD.
I tried:
(1) convert signal1 to TD and perform direct convolution with signal2
(2)Keep signal1 in FD ,convert signal 2 to FD, and perform multipication. then convert the results back to TD
I need the final results to be in TD.
However, Both reaults dont agree. Can someone Please help me to figure out the reason?mzmhttps://www.mathworks.com/matlabcentral/profile/authors/11231075tag:www.mathworks.com,2005:Question/4569892019-04-17T17:01:39Z2021-05-14T22:07:21Zimhistmatch() output is zero matrixI have two 16bit .tif grayscale images that I am reading into my workspace using imread(). The output variable is of the correct type (uint16), but if I inspect the matrix for this image, I dont see any value above 255. If I then do an imhistmatch() using these two images I read in (they are almost identical grayscale images), I get a zero matrix output from the imhistmatch() function. If I do the above process by first converting the uint16 image to uint8, then it works perfectly. I am unsure what is going on. Any thoughts?leonolovichhttps://www.mathworks.com/matlabcentral/profile/authors/5063547tag:www.mathworks.com,2005:Question/4701142019-07-03T16:46:02Z2021-05-14T22:06:09ZTo compute cost and gradient for a logistic regression problem:the function returns only zeroes even though the correct value is being computed(I know it because I executed the function body separately in command line and checked)function [J,grad]=costFunction(theta, X, y)
m = length(y);
z=X*theta;
h=sigmoid(z);
H=h.';
h1=log(H)*(-y);
h2=(log(1-H))*(1-y);
J=(h1-h2)/m;
s=h-y;
s=s.';
for i=1:3,
temp=(s)*X(:,i);
grad(i)=temp(1);
end
grad=grad./m;
% =============================================================
end
Nesara S Rhttps://www.mathworks.com/matlabcentral/profile/authors/15585800tag:www.mathworks.com,2005:Question/5153502020-04-04T16:24:40Z2021-05-14T21:57:32ZROC curve with multiclass SVM Hello All,
I am plotting the ROC curve for SVM multiclass(3 classes) task. Getting the error as "Index in position 2 exceeds array bounds (must not exceed 3)"
Error in ROC_SVM (line 70)
scores = double(score(:,final_best_SVM.ClassNames + 1))'; % Compute the posterior probabilities (scores)
My code is
%% Plotting ROC curve for SVM
[predictedLabels,score,cost] = predict(final_best_SVM, features_Testing);
scores = double(score(:,final_best_SVM.ClassNames + 1))'; % Compute the posterior probabilities (scores)
figure(2)
plotroc(dtTest_lab,scores)
title('ROC Curve for SVM')kavhttps://www.mathworks.com/matlabcentral/profile/authors/16342399tag:www.mathworks.com,2005:Question/4569992019-04-17T17:45:49Z2021-05-14T21:44:48ZWrite a function called get_distance that accepts two character vector inputs representing the names of two cities. The function returns the distance between them as an output argument called distance. For example, the call get_distance('Seattle, WA'function distance = get_distance(x,y)
[~,~,raw] = xlsread('Distances.xlsx');
col_labels = raw(1,:);
row_labels = raw(:,1);
try
distance = raw{contains(row_labels,y),contains(col_labels,x)};
catch
distance = -1;
end
end
error
Assessment result: incorrectNashville, TN and Las Vegas, NV
Variable distance has an incorrect value.
Assessment result: incorrectRandom city pairs
Variable distance has an incorrect value.
get_distance('Chattanooga, TN','Meads, KY') returned -1 which is incorrect.Abhishek singhhttps://www.mathworks.com/matlabcentral/profile/authors/14995171tag:www.mathworks.com,2005:Question/8302882021-05-14T18:58:49Z2021-05-14T21:36:28ZHow to keep information private?when I googled my names, all my activities( like asking questions, my profile) in Mathworks show up. I am wondering if I can keep it private? Thanksroudanhttps://www.mathworks.com/matlabcentral/profile/authors/11447515tag:www.mathworks.com,2005:Question/8303582021-05-14T21:19:05Z2021-05-14T21:36:21ZHow do i send image trought fsk modulatorI need send a image throught of fsk modulator an desmodulator
But i have a error
I try to use a function but don't work.
Can you help me please ?
%https://la.mathworks.com/matlabcentral/answers/3643-efficiently-converting-a-3d-matrix-to-a-2d-matrix
%https://es.mathworks.com/help/images/ref/imbinarize.html
%https://es.mathworks.com/help/images/ref/im2bw.htmlJohan Herreñohttps://www.mathworks.com/matlabcentral/profile/authors/22550605tag:www.mathworks.com,2005:Question/8302732021-05-14T18:43:01Z2021-05-14T21:33:45Zproblem in cell matrix operationsHello
I have code like this which gives out a 5*1 cell matrix:
row = [0; 1; 2; 3; 4] ;
Coh = [15;16 ;17; 18; 20;19;7;8;22;25] ;
N = length(A) ;
Csurf = cell(N,1) ;
for i = 1:N
if row(i) == 0
Csurf{i} = 0 ;
else
Csurf{i} = Coh(1:row(i)) ;
Coh(1:row(i)) = [] ;
end
end
end
----------------------------------------------------
Now imagine that both row and Coh become cell matrices by the below repmat command,
Nmc=2
BB = repmat({row},Nmc,1);
CV=repmat({Coh},Nmc,1);
I have to write a code which considers the first cell of both BB and CV together and do the calculations as in the first code and then consider the second cell of BB and CV together and do the same calculations. The result would be a 5*2 cell matrix as Nmc=2. How should i formulate this?should i define a for loop? i am not good at cell indexing!
Any help is highly appreciated.Pooneh Shah Malekpoorhttps://www.mathworks.com/matlabcentral/profile/authors/16932213tag:www.mathworks.com,2005:Question/8301582021-05-14T16:27:19Z2021-05-14T21:31:59ZPLEASE HELP!!!! PLOT STEP FUNCTION WITH DEFINED AMPLITUDEHello everyone,
I have a problem with plotting step function. I have a code about plotting a transfer function. I will add my code to show.
In my code, i want to change the default amplitude of transfer function. As I learned, Matlab has a default amplitude as 1. According to my research, there is a option about "Options for the step command". Here is the link: https://www.mathworks.com/help/control/ref/stepdataoptions.html#d123e129499
Here, I want to change my amplitude as 5. I think I might write opt = stepDataOptions('StepAmplitude',5);
But here there was a code which is [y,t] = step(sys,opt); and I dont get it what is the meaning of y and t. Why must we do smth like that?
And also I want to plot my transfer function after change the amplitude. And again, as my research, I think I must be write code as plot(t,y).
But why must we write (t,y) in the plot while we define [y,t]?
K_parameter = 1;
TL_parameter = 2;
TI_parameter = 3;
WN_parameter = 4;
t_parameter = 5;
zeta_parameter = 6;
F = K_parameter*tf([TL_parameter 1],[TI_parameter 1])*tf(1,[1/WN_parameter^2 2*zeta_parameter/WN_parameter 1]);
sys = F*exp(-t_parameter*tf('s'));
transfer_plot = stepplot(sys);
grid on
info = stepinfo(sys)
st = info.SettlingTimehgrlkhttps://www.mathworks.com/matlabcentral/profile/authors/15101666tag:www.mathworks.com,2005:Question/8298632021-05-14T11:13:07Z2021-05-14T21:26:49ZUITable Presentation (Columns/ Rows)I am using app designer and on a UI Table I would like that the table would work "transposed". E.g The parameters would be on the rows and the new entries would be added on new collumns. This would show the data in a more natural way for this application and I have more lateral space (in X direction) on the GUI than vertical space ( in Y direction).
Is there any way to make the table and then just present it "transposed", with the rows in the place of the columns? Even if only visually...Jose Santoshttps://www.mathworks.com/matlabcentral/profile/authors/14662011tag:www.mathworks.com,2005:Question/3929852018-04-06T02:40:54Z2021-05-14T21:24:14ZWhy does is take O(n^2) to append elements in matlab when it takes O(n) amortized time in theory?why doesn't matlab have O(n) amortized time to append elements to a growing array? I thought his was an algorithmically well understood problem. Isn't O(n^2) imply something is wrong with the implementation?
e.g. table doubling: https://www.youtube.com/watch?v=BRO7mVIFt08Brando Mirandahttps://www.mathworks.com/matlabcentral/profile/authors/2706824tag:www.mathworks.com,2005:Question/2982562016-08-03T11:45:25Z2021-05-14T21:23:47Zset(gca,'Ydir','reverse') not working in Quiver plots I am using Matlab 2010. I have to reverse the Y axis and for simple plots set(gca,'Ydir','reverse') is working fine. But when i am using set(gca,'Ydir','reverse') for Quiver plots, its not working. Yes i can manually reverse the axis after the quiver plot is ready ie from property editor but i want to save the plot on the go using Print and want set(gca,'Ydir','reverse') to work properly.
Please help . Too much time had been wasted by me on this. Can not get it right
Thanks
Bineet Bineet_Mehrahttps://www.mathworks.com/matlabcentral/profile/authors/7570096tag:www.mathworks.com,2005:Question/8303532021-05-14T21:16:15Z2021-05-14T21:22:16ZCalculating area between individual points that create a curveHello all,
I want to calculate the area between points that create a curve.
I am using MATLAB to simulate particles being advected on a plane. I have the initial position of those particles and I have the final position. I want to calculate the area between the initial position and final position of the particles
The points are in the attached mat file, where px is the position x of the particles for 10 frames and py is the position y of the particles for 10 frames. I want to calculate the area (green in image) between px(:,:,1),py(:,:,1) (black line in image) and px(:,:,10),py(:,:,10) (points with red line). Below is a plot of the final position of the points. One of the approaches I tried was fitting the data with a polynomial curve but that would introduce a significant error in the calculations and I want to avoid that.
How can I calculate the area without fitting the data?
Thank you!Sara Oliveira Pedro dos Santoshttps://www.mathworks.com/matlabcentral/profile/authors/17533161tag:www.mathworks.com,2005:Question/8300382021-05-14T13:55:04Z2021-05-14T21:21:18ZDraw a diagram for a formulaI want to get the figure 4.3
The required formulas are:
Zc = 4.02 * 10^6
ZL = 1.490 * 10^6
t = 28 * 10^-6
v = 2260
teta = 2*pi*t*f/v
Can anyone draw this output for 4.8 in MATLAB?selena robenhttps://www.mathworks.com/matlabcentral/profile/authors/22548237tag:www.mathworks.com,2005:Question/8179902021-04-30T12:19:25Z2021-05-14T21:19:58ZFull Factorial Design of ExperimentsHello together,
i am about to write a code that should produce me a txt file with a full factorial combination of the input of vectors. The vectors could have a different length. I know about the matlab function fullfact([,]) but since I will use decimal numbers i needed a differen solution.
I tested the code and it seems to work. But do I make a mistake, that I may have not seen yet? The vectors that i defined in this skript are just for example. Later on I will use a input and the vectors will result in much bigger ones.
clc
clear
pyrz = [1, 2];
pyrx = [1, 2, 3];
pyra = [1, 2];
%I need to know the final count of columns in the resulting matrix
Avert=length(pyrz)*length(pyrx)*length(pyra);
if sum (pyrx) == 0
pyrx = zeros(1, Avert);
elseif sum (pyrx) ~= 0
count = Avert/length(pyrx);
pyrx = repmat(pyrx,1,count);
end
count = Avert/length(pyrz);
pyrz = repmat(pyrz,1,count);
pyrz = sort(pyrz);
count = Avert/length(pyra);
pyra = repmat(pyra,1,count);
pyra = sort(pyra,'descend');
Maximilian Bayerlhttps://www.mathworks.com/matlabcentral/profile/authors/10375990tag:www.mathworks.com,2005:Question/8299132021-05-14T12:12:56Z2021-05-14T21:18:54ZFill a timetable outside the gapsConsider the following timetable, which is just a toy to explain the problem
dates = [datetime(2020,1,1) datetime(2020,1,1) datetime(2020,1,2) datetime(2020,1,2) datetime(2020,1,3) datetime(2020,1,3) datetime(2020,1,4)];
t = timetable(dates',["a" "c" "a" "b" "a" "a" "c"]',[2 1 3 2 1 2 1]')
Time Var1 Var2
___________ ____ ____
01-Jan-2020 "a" 2
01-Jan-2020 "c" 1
02-Jan-2020 "a" 3
02-Jan-2020 "b" 2
03-Jan-2020 "a" 1
03-Jan-2020 "a" 2
04-Jan-2020 "c" 1
For each date and for each unique string in Var1 I would like to obtain the sum of the values in Var2. That is:
(1) if for a specific date a string does not appear, then 0 must be returned
(2) if for a specific date a string appears only once, then the corresponding value in Var2 must be returned
(3) if for a specific date a string appears multiple times, then the sum of the corresponding values in Var2 must be returned
The function retime satisfy (2) and (3) completely, but (1) only partially in the sense that it returns 0 only if the string appears in a previous date AND in a following date, that is retime only fills the gaps.
In the following the row with 04-Jan-2020 and 0 is missing
retime(t(t.Var1=="a","Var2"),'daily','sum')
Time Var2
___________ ____
01-Jan-2020 2
02-Jan-2020 3
03-Jan-2020 3
In the following the rows with dates 1, 3, 4 january (and 0 in Var2) are missing
retime(t(t.Var1=="b","Var2"),'daily','sum')
Time Var2
___________ ____
02-Jan-2020 2
The following is correct
retime(t(t.Var1=="c","Var2"),'daily','sum')
Time Var2
___________ ____
01-Jan-2020 1
02-Jan-2020 0
03-Jan-2020 0
04-Jan-2020 1
Is there an easy way to resolve the problem and without using for loops? The data I'm working with has thousands of rows and tens of columns, I tried with loops but it's time consuming.
In the toy example an easy workaround is to manually add the missing strings at the start and at the end of the timetable, in such a way we can extend the gaps to cover all the datetimes and then retime can fill all the missing values.
However, this is easy only for timetables with a simple structure, moreover it might have some unwanted side effects
t = [timetable(datetime(2020,1,1),"b",0) ; t ; timetable([datetime(2020,1,4);datetime(2020,1,4)],["a";"b"],[0;0])]
Time Var1 Var2
___________ ____ ____
01-Jan-2020 "b" 0
01-Jan-2020 "a" 2
01-Jan-2020 "c" 1
02-Jan-2020 "a" 3
02-Jan-2020 "b" 2
03-Jan-2020 "a" 1
03-Jan-2020 "a" 2
04-Jan-2020 "c" 1
04-Jan-2020 "a" 0
04-Jan-2020 "b" 0 giannithttps://www.mathworks.com/matlabcentral/profile/authors/11208505tag:www.mathworks.com,2005:Question/8301132021-05-14T15:28:29Z2021-05-14T21:16:29ZHow to create a vector by indexing elements within each cell of a 1xN cell arrayI have a 1xN cell array (raw_array) and I am trying to create a vector of N values using the same indexing (a,b) within each cell.
I can use this expression to extract a scalar value from a single cell:
raw_array{1,n(x,y)}(a,b)
Here n(x,y) is just a means of indexing the correct cell within the cell array.
Let's say y varies from 1-10, i earlier tried the following:
raw_array{1,n(x,1:10)}(a,b) but clearly this doesn't work (error msg: Expected one output from a curly brace or dot indexing expression, but there were 10 results).
I really want to avoid writing each vector element separately, e.g. [raw_array{1,n(x,1)}(a,b) raw_array{1,n(x,2)}(a,b)...]
Can anybody please give me a hint or suggestion?
ThanksDaniel Rowehttps://www.mathworks.com/matlabcentral/profile/authors/17975180tag:www.mathworks.com,2005:Question/8288882021-05-13T01:02:43Z2021-05-14T21:10:52ZHow to eliminate gap between tile chartsHey guys,
I am trying to create a graph with 3 sections, each with a different x axis but the y axis is the same throughout. I used tile chart layout learnt from https://au.mathworks.com/help/matlab/creating_plots/graph-with-multiple-x-axes-and-y-axes.html and set TileSpacing = 'none', but there is still a gap between the sections as shown in the picture. How do you eliminate the gaps between the sections?
x = 0:0.1:60;
y1 = 4.*cos(x)./(x+2);
y2 = 5*sin(x)+0.5
figure
t = tiledlayout(1,3,'TileSpacing','none'); %no tile spacing?
bgAx = axes(t,'XTick',[],'Ytick',[],'Box','off');
bgAx.Layout.TileSpan = [1 3];
%plot part 1
ax1 = axes(t);
plot(ax1,x,y2);
xline(ax1,15,':');
ax1.Box = 'off';
xlim(ax1,[0 15])
xlabel(ax1,'First Interval')
%plot part 2
ax2 = axes(t);
ax2.Layout.Tile = 2
plot(ax2,x,y1)
xline(ax2,15,':');
xline(ax2,45,':');
ax2.YAxis.Visible = 'off';
ax2.Box = 'off';
xlim(ax2,[15 45])
xlabel(ax2, 'Second Interval')
%plot part 3
ax3 = axes(t);
ax3.Layout.Tile = 3
plot(ax3,x,y2)
xline(ax3,50,':');
ax3.YAxis.Visible = 'off';
ax3.Box = 'off';
xlim(ax3,[50 60])
xlabel(ax3, 'Third Interval')
%link axes
linkaxes([ax1 ax2 ax3],'y') Mengyuan Lihttps://www.mathworks.com/matlabcentral/profile/authors/16360386tag:www.mathworks.com,2005:Question/8303482021-05-14T21:10:21Z2021-05-14T21:10:21Zhow to find a given parameter in state flow chartWhen compiling a stateflow model, the system complains parameters 'myParameterName' and 'myParameterName' are conflicting. Declare a single parameter 'myParameterName' in the chart.
When I went into the chart, I couldn't find where parameter "myParameterName" is used. Is there a way to search and find which blocks are using the parameters?
Thanks.
Rui Zhanghttps://www.mathworks.com/matlabcentral/profile/authors/3843061tag:www.mathworks.com,2005:Question/2419402015-09-10T09:49:31Z2021-05-14T21:08:56ZRANOVA using unbalanced designCan anyone please advise if there is a way to use ranova with an unbalanced within-subject design? I've tried using NaNs for instances where I don't have a measurement, but that returns an error. Thanks.Asad Malikhttps://www.mathworks.com/matlabcentral/profile/authors/6903862tag:www.mathworks.com,2005:Question/2333812015-08-12T06:40:32Z2021-05-14T21:06:01Zfrom where can I download install_addon.m file ? when I use this command in the command window (matlab): install_addon('smlink.r2013a.win64.zip') The following error occurs: Undefined function 'install_addon' for input arguments of type 'char'.
I know i have to download the install_addon.m file, but I do not know from where I can download it. plz help me. Thank youSameeksha Katochhttps://www.mathworks.com/matlabcentral/profile/authors/6767241tag:www.mathworks.com,2005:Question/8295032021-05-13T21:52:12Z2021-05-14T21:01:38ZLinear Label on Logarithmic PlotHello!
I have an "example" regression loglog graph to show someone. The Y axis is not very large, but is less than 1, so it shows up as log rather than linear.
Is there a way to do this cleanly? Here's the code:
% reggie
rng('shuffle');
Intercept = 1000;
Slope = -1.6;
dist = 150:50:300;
vib = Intercept*(dist.^Slope);
minx = 50;
maxx = 400;
figure
loglog(dist,vib,'o','MarkerFaceColor','r')
xlim([minx maxx])
ylim([0.05 1])
hold on
grid on
grid minor
loglog([minx maxx],[Intercept*(minx^Slope) Intercept*(maxx^Slope)],'--');
xlabel('Distance (ft)');
ylabel('Vibration (in/s)');
title('Regression Example');
for n = 1:length(dist)
scatterling = 0.3 * vib(n);
median_value = vib(n);
new_values = scatterling.*randn(6,1)+median_value;
loglog(dist(n),new_values,'diamond','LineStyle','none');
end
newdist = 100;
reduction_factor = 0.65;
newvib = (reduction_factor * Intercept) *(newdist.^Slope);
loglog(newdist,newvib,'o','MarkerFaceColor','b');
scatterling = 0.4 * newvib;
median_value = newvib;
new_values = scatterling.*randn(6,1)+median_value;
loglog(newdist,new_values,'diamond','LineStyle','none','MarkerFaceColor','g');
Thanks!
DougDouglas Andersonhttps://www.mathworks.com/matlabcentral/profile/authors/4227986tag:www.mathworks.com,2005:Question/2882482016-06-07T14:53:09Z2021-05-14T20:57:52ZHow to disable openMP with Matlab Coder?I want to use Matlab Coder to compile a function that will not profit much from multithreading. Although I use
codegen -O disable:openmp
the resulting C source includes omp.h and tries to find vcompXXX.dll when run.
How can I switch off OpenMP use completely?
System: Matlab Coder 2016a/Windows 10/Visual C++ 2013Matthias Frühwirthhttps://www.mathworks.com/matlabcentral/profile/authors/8114819tag:www.mathworks.com,2005:Question/8294532021-05-13T19:56:08Z2021-05-14T20:49:28ZSolving system non-linear equations Dear Matlab Community,
I would like to ask a question regarding the solving of a 4 equations non-linear system.
I have tried two approaches: the first one by defining a system and use solve to extract the solutions, but I get into an infinite loop and Matlab doesn't give any solution:
syms E1 X P E2
eq1 = E0 + E1*(X)^(sr(1))+E2*(P)^(sr(1)) == Eapp(1);
eq2 = E0 + E1*(X)^(sr(2))+E2*(P)^(sr(2)) == Eapp(2);
eq3 = E0 + E1*(X)^(sr(3))+E2*(P)^(sr(3)) == Eapp(3);
eq4 = E0 + E1 + E2 == Ei
eqns = [eq1 eq2 eq3 eq4];
vars = [E1 X P E2];
A = solve(eq1, eq2, eq3, eq4)
My unknown are E1, X, E2, P and all the others are defined parameters.
I have also tried to implement a function:
function F = root2d(x)
sr = [0.05 0.1 0.5 1];
Eapp = [2.09 2.18 2.27 2.4].*1e6;
Ei = 2.55e6;
E0 = 2.14e6;
F(1) = E0 + x(1)*(x(2))^(sr(1))+x(3)*(x(4))^(sr(1)) - Eapp(1);
F(2) = E0 + x(1)*(x(2))^(sr(2))+x(3)*(x(4))^(sr(2)) -Eapp(2);
F(3) = E0 + x(1)*(x(2))^(sr(3))+x(3)*(x(4))^(sr(3)) - Eapp(3);
F(4) = E0 + x(1) + x(3) - Ei;
end
Said function is called in the main script and I have used fsolve to extract the solutions:
fun = @root2d;
x0 = [1.5e6,1,1.5e6,1];
x = fsolve(fun,x0)
In this case, my problem is that I cannot properly set an initial interval x0 where I can look for the solutions, since I cannot plot a 4 variables function to visually see the zeros, I get the following error (I have estimated the values of E1 and E2 as order of magnitude but I have no clue of which the values of P and X should be):
No solution found.
fsolve stopped because the relative size of the current step is less than the
value of the step size tolerance squared, but the vector of function values
is not near zero as measured by the value of the function tolerance.
Does anyone have any tip to solve this problem?
LucreziaLucrezia Mainihttps://www.mathworks.com/matlabcentral/profile/authors/18127992tag:www.mathworks.com,2005:Question/8302632021-05-14T18:39:08Z2021-05-14T20:43:53ZCuravture/Slope FilteringI am currently making a program to process some data, part of this process is removing graphs that are sloped, such as the one below:
And retaining graphs that have curvature such as the one below:
I don't come from a strong applied mathematics background, one idea was to take a partial derivative and compare to a set threshold, the curvature formula is another possibility. Does anyone have any experience with this type of problem you would be willing to share?Ian Bunkerhttps://www.mathworks.com/matlabcentral/profile/authors/22103789tag:www.mathworks.com,2005:Question/7173732021-01-14T20:20:53Z2021-05-14T20:42:52Zdifferential equations of the type Q(t,h(t) where h(t) is based on volumeProblem 1.
1. Write a differential equation describing mass conservation in a reservoir for a generic
streamflow input Qin and outlet flow determined by a pipe at the bottom of the reservoir and an
emergency spillway (see figure and equations below).
where c1 is orifice coefficient, Ac is orifice cross-sectional area, c2 is weir coefficient; Lw is the
length of the weir crest. Assume that the outflow is equal to the inflow when the reservoir is full.
Also, the relation between the water volume in the reservoir and the water surface elevation is as
follows:
2. Solve the equation in Matlab using as the input hydrograph a rectangular pulse with flow rate
of 50 m3/s and duration of 10 hours, and let hR-Max=6m, circular orifice size=0.6 m, c1=0.82 (assume
a short pipe), c2=1 (assume a broad-crested weir), VR-Max=1,000,000 m3, Hspill=3m, Lw=3m, and
assume that at time zero h(0)=1m. Plot the input and the output hydrographs.
I have been at this for about 4 months. I have read all the mathworks files and several University files on this subject. Yet every time I try to set dv/dt = ht/dt I get tspan errors. I even asked support for help and got notta. The files attached are not all of my attempts just the clossest attempts and the original pdf question. Please if you cite a file location accompony it with actual code that relates to my question. I am willing to bet that I have already read it and do not understand it. I am a nontraditional student and a disabled veteran.Christopher Van Hornhttps://www.mathworks.com/matlabcentral/profile/authors/15276421tag:www.mathworks.com,2005:Question/8303382021-05-14T20:30:57Z2021-05-14T20:34:40Zmatlab code for FEM with elements of C1 continuityHello team!
I wish to write a matlab code for FEM with elements of C1 continuity (C1 elements).
The code below is for 2D plane stress with 4-node quadrilateral elements (CO shape functions).
https://ch.mathworks.com/matlabcentral/fileexchange/31788-the-plane-stress-problem
Does anyone has code for C1 elements FEM or something that can help me?
Whats the changes that should I do on the C0 code above to become C1?
Thanks in advance.Vlasis Demostheneshttps://www.mathworks.com/matlabcentral/profile/authors/13174876tag:www.mathworks.com,2005:Question/8301732021-05-14T16:38:16Z2021-05-14T20:24:08ZWhy isn't this file loading method working?I've had success in the past piecing together proper file strings name to call upon the right file name. Here I'm trying to compare saved data sets and plot their data series one at a time, since all data sets share the same variable names.
I figured I could just loop through each file name and plot their respective series independent of one another simply by using the 'hold on' syntax to keep previous data sets since all files of interest I want to compare all have the same variable names. That makes sense right? I would just grab one variable of a data set, plot it and hold on, and rewrite over the variable name for the next data set of interest.
I've attached a code screen shot for reference. The two files/datasets I'm working with right now can be seen in the current folder workspace. Like I've said, I've used this technique in the past but cannot recognize why the data sets are not being loaded.
Any advice would be appreciated!
Kieran Funghttps://www.mathworks.com/matlabcentral/profile/authors/19129518tag:www.mathworks.com,2005:Question/8303332021-05-14T20:22:22Z2021-05-14T20:22:22ZGaussian filter with fspecial versus imgaussfilt I have two questions. First, I want to filter a function with a Gaussian that has a standard deviation with dimensions of length; units are microns. The dx spacing in the code below has units of microns. If the filters in Matlab require their standard deviation provided in 'nodes', is the way to associate the two as such:
x = linspace(-5,5,200); % Units in microns
dx = x(end) - x(end-1); % Spacing in microns
stdev = 0.5; % Desired Gaussian filter standard deviation. Units in microns.
nodesPerSigma = round(stdev/dx,0); % Is this the way to associate nodal sigma with a dimensional sigma?
% Filter with IMGAUSSFILT
zf = imgaussfilt(Z,nodesPerSigma);
My second question is: in the code below, why do zf1 and zf2 produce different results if zf2 matches the result from imgauss filt? The built-in function imgaussfilt selects the filter size based on the sigma provided. It uses 2*ceil(2*sigma)+1 to determine the filter size. This is smaller than the 'rule of thumb' (see link below) of 2*3*sigma. Does this mean that imgaussfilt is not using the entire Gaussian??
clear;
x = linspace(-5,5,200); % Units in microns
[X,Y] = meshgrid(x,x);
Z = X .* exp(-X.^2 - Y.^2);
%figure; surf(X,Y,Z)
%figure; plot(X(100,:),Z(100,:))
dx = x(end) - x(end-1); % Spacing in microns
stdev = 0.5; % Desired Gaussian filter standard deviation. Units in microns.
nodesPerSigma = round(stdev/dx,0); % Is this the way to associate nodal sigma with a dimensional sigma?
% Filter with IMGAUSSFILT
zf = imgaussfilt(Z,nodesPerSigma);
filtSize = 2*3*nodesPerSigma;
if mod(filtSize,2) == 0
filtSize = filtSize + 1;
end
% Filter with fspecial's Gaussian using the 'rule of thumb' for the filter
% size. See link below.
gfilter = fspecial('gaussian',[filtSize filtSize],nodesPerSigma);
zf1 = imfilter(Z,gfilter,'same');
% Filter with fspecial's Gaussian but using the filter size in documentation.
filtSize2 = 2*ceil(2*nodesPerSigma)+1; % This will produce a result matching the imgaussfilt.
gfilter2 = fspecial('gaussian',[filtSize2 filtSize2],nodesPerSigma);
zf2 = imfilter(Z,gfilter2,'same');
figure; plot(X(100,:),Z(100,:),'k',X(100,:),zf(100,:),'r',X(100,:),zf1(100,:),'g',X(100,:),zf2(100,:),'*b')
legend('Original Function','Using imgaussfilt','Using fspecial Gaussian','Using fspecial Gaussian Again')
Link containing info of a rule of thumb for sizing the Gaussian filter. In essence the goal is to include all of the Gaussian curve and not much more, for efficiency.
https://www.mathworks.com/matlabcentral/answers/231351-what-is-the-correct-number-of-pixels-for-a-gaussian-with-a-given-standard-deviation?s_tid=srchtitlePaul Safierhttps://www.mathworks.com/matlabcentral/profile/authors/12547459tag:www.mathworks.com,2005:Question/8303282021-05-14T20:20:35Z2021-05-14T20:21:34Zparfeval getting stuck in for loop and blocking fetchNext Hi,
I'm trying to use parfeval and fetchNext, but I don't think I'm settling them up correctly. My parallel pool has 4 workers. I'm setting up parfeval in a for-loop, as shown in the manual, with fetchNext in a subsequent for-loop. I thought that fetchNext should be able to extract values from parfeval as they are produced, but it appears to only extract them once all iterations of the first loop are complete.
I'm practising with the code from the parfeval and fetchNext pages of the manual. When I put a breakpoint at the 'fetchNext' line of the code below, it always shows all of the FevalFuture items complete before the breakpoint is reached. If I include a "disp('par')" and "disp('fetch')" inside each loop then all the "disp('par')" are printed out first and then all the "disp('fetch')" are printed out afterwards.
Also, on this code using fetchNext is actually slower than fetchOutputs. The fetchNext version takes 73 seconds, whereas the fetchOutputs version at the bottom only takes 31 seconds.
Any help very much appreciated!
p = gcp();
tic
for idx = 1:10000
f(idx) = parfeval(@rand,1,1);
end
for idx = 1:10000
[completedIdx,value(completedIdx)] = fetchNext(f);
end
toc
p = gcp();
tic
for idx = 1:10000
f(idx) = parfeval(@rand,1,1);
end
R = fetchOutputs(f);
tocFelicity Freemanhttps://www.mathworks.com/matlabcentral/profile/authors/7262994tag:www.mathworks.com,2005:Question/4143802018-08-10T12:02:49Z2021-05-14T20:18:59ZMatlab code for Reactive Power Optimization Using Genatic algorithm IEEE 14 busReactive Power Optimization Using Genatic algorithm IEEE 14 busGirijashankar Sahoohttps://www.mathworks.com/matlabcentral/profile/authors/13276809tag:www.mathworks.com,2005:Question/8303232021-05-14T20:17:42Z2021-05-14T20:17:42ZWant to Built GUI For MPU9250 to estimate OrientationI want to create GUI of MPU9250 for my project that it can moves in directions similar to the hardware movement anyone can help me in figuring out this .
There is also a documentation in Mathworks as estimating Orientation Using Inertial Sensor Fusion and MPU-9250 and it also contain that GUI.
How can i make that GUI
fyp matlabhttps://www.mathworks.com/matlabcentral/profile/authors/21557921