https://se.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-08-19T08:12:12Ztag:se.mathworks.com,2005:Question/4757122019-08-11T08:47:39Z2019-08-19T08:12:12Zwhy my YOLO v2 detector produces no results?i use a YOLO v2 detector to detect cells in images like this one (i used this specific one to train the detector) of two different types to train the detector.
i give the detector the boxes as in figure.
i use the following lines to train the detector:
T=table(names2',roi1',roi2');
%names2' contains the image file path
%roi1' and roi2' are the matrices M*4 with the [x,y,width,height] of %boxes containing the cells
numClasses=width(T)-1;
anchorBoxes = [
40 40
60 60
80 80
100 100
];
baseNetwork = resnet50;
featureLayer = 'activation_40_relu';
imageSize = [1080 1920 3];
options = trainingOptions('sgdm', ...
'MiniBatchSize', 16, ....
'InitialLearnRate',1e-3, ...
'MaxEpochs',10,...
'CheckpointPath', tempdir, ...
'Shuffle','every-epoch');
lgraph = yolov2Layers(imageSize,numClasses,anchorBoxes,baseNetwork,featureLayer);
[detector,info] = trainYOLOv2ObjectDetector(T,lgraph,options)
----------------------------------------------------------------------------------------------------------------
i get the following outputs:
Training on single CPU.
|========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | RMSE | Loss | Rate |
|========================================================================================|
| 1 | 1 | 00:00:43 | 3.32 | 11.0 | 0.0010 |
| 10 | 10 | 00:07:02 | 1.16 | 1.4 | 0.0010 |
|========================================================================================|
detector =
yolov2ObjectDetector with properties:
ModelName: 'Var2'
Network: [1×1 DAGNetwork]
ClassNames: {'Var2' 'Var3'}
AnchorBoxes: [4×2 double]
TrainingImageSize: [1080 1920]
info =
struct with fields:
TrainingLoss: [11.0190 5.5807 4.0740 3.1020 2.1962 1.3285 1.3990 1.5349 1.6414 1.3550]
TrainingRMSE: [3.3195 2.3623 2.0184 1.7613 1.4820 1.1526 1.1828 1.2389 1.2812 1.1641]
BaseLearnRate: [0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010 0.0010]
a =
yolov2ObjectDetector with properties:
ModelName: 'Var2'
Network: [1×1 DAGNetwork]
ClassNames: {'Var2' 'Var3'}
AnchorBoxes: [4×2 double]
TrainingImageSize: [1080 1920]
----------------------------------------------------------------------------------------------------------------
when i use the detector to a similar image i get no results. The [bboxes, scores] matrix is empty.
what is my error?
Filippo profumohttps://se.mathworks.com/matlabcentral/profile/authors/15146714-filippo-profumotag:se.mathworks.com,2005:Question/4603082019-05-05T00:11:44Z2019-08-19T08:10:02ZHow to plot system of fractional delay differential equationsLet us consdier the system of fractional order delay differential equation
D^[alpha} x(t)= a*x(t) ( 1- x(t)/k ) - (b* x(t)* y(t-tau) ) / ( 1+c* x(t) );
D^[alpha} y(t)= ( b* x(t)* y(t-tau) ) / ( 1+c* x(t) )-d y(t);
tau=0.5; a=1; k=2; b=0.5; c=1.5; [x(t), y(t)]=[2,1] for all t in [-0.5, 0].
How to plot the above system?RAMESH Phttps://se.mathworks.com/matlabcentral/profile/authors/11294168-ramesh-ptag:se.mathworks.com,2005:Question/4766492019-08-19T07:02:19Z2019-08-19T08:08:51ZFiltering data by 1x1 struc Hello, I have a dataset which indicates different locations of a stimulus eg row 3, column 4. There are 8 possible locations the stimulus may be located. I need to filter them by locations (by its specific row and column) but in the dataset, i need to first click on a blue link that states 1x1 structure, that contains its corresponding row and column). May I know what I need to input to filter by stimulus location, especially when the exact info is not found until I click on it?
Many thanks, all help is appreciated. :DCharmshttps://se.mathworks.com/matlabcentral/profile/authors/14739626-charmstag:se.mathworks.com,2005:Question/4745582019-08-02T08:38:05Z2019-08-19T08:06:58ZHow to save nested cells in mat fileI want to save data in such a way that a cell holds another cell array.
My main table will consist of cells, each of which will hold 24 cell arrays of size 1X63. How to save data in such a manner?
The idea is that I am encoding a words with numbers
For example. If my word is Aalen, A = 1x63 vector, a = 1x63 vector, l = 1x63 vector, e=1x63 vector, n=1x63 vector.
So for each word in my list, I waant to save a vector for each letter in the word.Sanjana Sankarhttps://se.mathworks.com/matlabcentral/profile/authors/15815881-sanjana-sankartag:se.mathworks.com,2005:Question/4721022019-07-17T07:51:51Z2019-08-19T08:01:28ZCompile a C code on a Raspberry Pi with a library generated with Matlab C CoderHello,
I have trouble using the Matlab C coder app from a PC (windows 10) to my Raspberry Pi3 B V1.2
First a contextual explanation :
I used to make measurements on the RPi then analyse it with matlab and now I want to do everything on the RPi
My algorithm is not completely finished yet (eg: some thresholds needs to be tuned a bit) in the analyse code, so I wanted to keep a C code I could modify later on the Pi and not an executable that I had to change on matlab everytime I wish to make a change (I do not have regular access to this PC).
What was my goal before I had issues :
Generating all the .c and .h files with matlab
Compiling them in a static library in my RPi (eg: "libmylib.a" in Linux)
Compiling the main.c file with the new library
So I used the Matlab C code generator with the following settings (I downloaded the addon from RaspberryPi harware):
I then I tranferred the created folder to my RPi to generate the library, I used the soft Code::Bocks (open source IDE) and this is where I met my first problem: 4 header files were missing to compile the static library : emlrt.h, matrix.h, mex.h and twmtypes.h
I managed to find them on my Matlab program folder but it is weird that they were not included in the first place in the folder generated my the C coder app.
Anyway after adding those 4 files in my library folder, I managed to compile the static library which gave me two important files, the library "libmylib.a" and the "main.o" which I tried to compile using the following bash commande
gcc main.o -Ldirmylib -lmylib -o myoutput
This command resulted in an error with undefined references to several functions and amongst them "sin", "cos", "floor", "ceil"...
So it seemed to me that the mathematic library ("libm.a") was not included (once again this is very surprising to me), I corrected this point by changing the command to
gcc main.o -Ldirmylib -lmylib -lm -o myoutput
Now the classic math functions are well-defined, but their is still and error and I cannot find the following functions :
In function« emlrt_marshallOut » :
« emlrtCreateNumericArray »
« emlrtMxSetData »
« emlrtSetDimensions »
« emlrtAssign »
In function« emxFree_real_T » :
« emlrtFreeMex »
In function« emxInit_real_T » :
emlrtMallocMex »
« emlrtPushHeapReferenceStackR2012b »
In function« myalgo_api » :
« emlrtHeapReferenceStackEnterFcnR2012b »
« emlrtHeapReferenceStackLeaveFcnR2012b »
In function« myalgo_atexit » :
« emlrtEnterRtStackR2012b »
« emlrtLeaveRtStackR2012b »
« emlrtDestroyRootTLS »
« mylib_xil_terminate »
« mylib_xil_shutdown »
« emlrtExitTimeCleanup »
In function« myalgo_initialize » :
« emlrtClearAllocCountR2012b »
« emlrtEnterRtStackR2012b »
« emlrtFirstTimeR2012b »
In function« myalgo_terminate » :
« emlrtLeaveRtStackR2012b »
« emlrtDestroyRootTLS »
In function« myalgo_mexFunction » :
« emlrtErrMsgIdAndTxt »
« emlrtErrMsgIdAndTxt »
« emlrtReturnArrays »
In function« mexFunction » :
« mexAtExit_800 »
In function« mexFunctionCreateRootTLS » :
« emlrtCreateRootTLS »
« makeComplexCXSparseMatrix » :
« cs_ci_spalloc »
In function« solve_from_lu_ci » :
« cs_ci_malloc »
« cs_ci_ipvec »
« cs_ci_lsolve »
« cs_ci_usolve »
« cs_ci_ipvec »
« cs_ci_free »
In function« solve_from_qr_ci » :
« cs_ci_calloc »
« cs_ci_ipvec »
« cs_ci_happly »
« cs_ci_usolve »
« cs_ci_ipvec »
« cs_ci_pvec »
« cs_ci_utsolve »
« cs_ci_happly »
« cs_ci_pvec »
« cs_ci_free »
collect2: error: ld returned 1 exit status
Does anyone know what to do in this situation ? I have a feeling that the Matlab C coder app does not do all the job (dur to the header files and math library missing)...
Thanks in advance
MathiasMathias Blandeauhttps://se.mathworks.com/matlabcentral/profile/authors/6538976-mathias-blandeautag:se.mathworks.com,2005:Question/4766422019-08-19T06:13:02Z2019-08-19T08:01:06ZHow can I include a time delay in Simulink of the below equation?Hi All, i am designing a Decoupling controller for a 2x2 TITO of a flotation column, please can you assist me on ways i can insert the below equation in simulink.
Ayanda Lesetlahttps://se.mathworks.com/matlabcentral/profile/authors/8540305-ayanda-lesetlatag:se.mathworks.com,2005:Question/4761082019-08-14T11:56:17Z2019-08-19T07:59:38ZWhy parfor doesn't work always? I have Matlab R2017b installed on my PC. I have a quite heavy program to run on Matlab, so I choose to use parfor since all the computations are indipendent and there are about 4000 iterations. Last week it worked fine on my 4 cores, today it doesn't even if I changed nothing. My code runs until the parfor line, it opens the parallel pool and I can see in tne command window the 4 workers, but after that nothing happens, the CPU goes to zero but Matlab appears busy with no reason. Does anybody know why suddenly parfor stopped working?
Thank youMirela Fetescuhttps://se.mathworks.com/matlabcentral/profile/authors/7811743-mirela-fetescutag:se.mathworks.com,2005:Question/4766542019-08-19T07:52:08Z2019-08-19T07:53:28ZUsing a Custom function which takes filename as input in Matlab Function Block, Simulink.I have a written a matlab funcion which takes in a CSV data file and does some processing to give out 3 distinct tables as output.
I want to use it in Simulink so, I selected a Matlab Function Block and added the function there. The input for the function has to be a Filename. But, I didnt find any way where I can pass the filename as input(string).
Is there a way to pass that file name as input to the function block, for it to run the embedded matlab function further?
If this is not the right way then please suggest me how to go about this.
I need to have a simulink model which would ask for the file and does the processing as written in the matlab script.manoj hanuhttps://se.mathworks.com/matlabcentral/profile/authors/3610041-manoj-hanutag:se.mathworks.com,2005:Question/4766172019-08-18T21:14:08Z2019-08-19T07:53:24Zhow can call a functionHello everyone,
how can i call this function in an other function?
i need to plot a, b, c and d:
function [o, a, b, c, d] = ObjectiveFunction(X )
a=sum(throughputS, 'all');
b=sum(throughputT, 'all');
c=sum(throughputCN, 'all');
d=sum(throughputCR, 'all');
Thanks alotbrahmi ibtissemhttps://se.mathworks.com/matlabcentral/profile/authors/7283922-brahmi-ibtissemtag:se.mathworks.com,2005:Question/4765112019-08-17T13:20:10Z2019-08-19T07:52:42ZHow can I solve a complicated symbolic integralHello.
I was going to solve this symbolic integral with int():
clear all
clc
syms k r R CosTheta M m
I=int((k*sin(k*r)/(k*r))*(1/(1+exp(0.2*((2.06*(10^7)*k*k)-M)))),k,[0 9.18])
but I got this as the solution:
I =
int(sin(k*r)/(r*(exp(4120000*k^2 - M/5) + 1)), k, 0, 459/50)
I found out that if remove the term 'k*k' from the expression, the the integral will be solved; in dact if I run:
clear all
clc
syms k r R CosTheta M m
I=int((k*sin(k*r)/(k*r))*(1/(1+exp(0.2*((2.06*(10^7))-M)))),k,[0 9.18])
then I get this as the solution:
I =
(2*sin((459*r)/100)^2)/(r^2*(exp(4120000 - M/5) + 1))
Now what can I do th solve my integral expression?
Regards.Hamed Pouriahttps://se.mathworks.com/matlabcentral/profile/authors/15741598-hamed-pouriatag:se.mathworks.com,2005:Question/4370092018-12-23T15:24:03Z2019-08-19T07:51:57ZHow to call an app design function from an external .m fileHi, I have an app design application myapp.mlapp and a function myfunc.m
in the app designer myfunc is called and it should calculate something for me and then plot a dada, this plot should be drawn in an UI Axes of myapp app design but i don't know how to do this.
I tied these:
Making an object of mlapp file and then call the axes:
app = myapp;
plt = app.UiAxes1;
plot(plt,x,y);
but this code run myapp each time and i don't want to run myapp because its open already.
2. Calling a function in myapp
i made a function called func2 in app design code view and wanted to call it and let it does the things like:
app = myapp;
app.func2(x,y);
but it doesn't pass the x,y to the func2 in app designer, how can i solve this?
Regards.Iman Fakharihttps://se.mathworks.com/matlabcentral/profile/authors/14415942-iman-fakharitag:se.mathworks.com,2005:Question/4765302019-08-17T16:55:38Z2019-08-19T07:51:28ZHow to define stepchanges, variable BC for different timeintervalls using pdepe?I am trying to define stepchanges of relative humidity at the boundary of a slab varying from 0.9 to 0.3 every 12 hours without any progress. The code is working without any issues for only one single BC but not otherwise. Any idea how I can get it? Thanks!
function parabolicmoisture
global tp a_v tend v_s delta exi
L=0.15;
k=0.028;
rho=156;
cp=990;
mu=4.25;
D=25*10^-6;
delta=D/mu;
v_s=17.28e-3;
exi=5/0.65;
a_v=(delta*v_s)/exi;
m = 0;
tp=24*3600;
tend=2*tp;
x = linspace(0,L,1000);
t = linspace(0,tend,2000);
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
RH = sol(:,:,1);
% A solution profile can also be illuminating.
plot(x,RH(end,:),'r--','LineWidth',2)
hold on
plot(x,RH(3*end/4,:),'b.-','LineWidth',1)
hold on
plot(x,RH(2*end/4,:),'k','LineWidth',1)
hold on
plot(x,RH(1*end/4,:),'*')
title(strcat('Solution at t = ', num2str(tend)))
legend('48h','36h','24h','12h')
xlabel('Distance x')
ylabel('RH (%)')
% %Plot surface temperature vs. time
% figure, plot(t,RH(:,1))
% title('Surface RH')
% xlabel('Time (s)')
% ylabel('RH (%)')
% --------------------------------------------------------------
function [c,f,s] = pdex1pde(x,t,u,DuDx)
global a_v v_s delta exi
c=1/a_v;
f = 1*DuDx;
s = 0;
% --------------------------------------------------------------
function u0 = pdex1ic(x)
u0 = 0;
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
global tend
%
if t<(tend/4)
pl = ul-0.9;
elseif t>=(tend/4) || t<tend/2
pl = ul-0.3;
elseif t>=tend/2 || t<3*tend/4
pl = ul-0.9;
elseif t>=3*tend/4
pl = ul-0.3;
end
ql = 0;
pr = ur;
qr = 0;
Ali Karimhttps://se.mathworks.com/matlabcentral/profile/authors/12044905-ali-karimtag:se.mathworks.com,2005:Question/4766342019-08-19T04:48:39Z2019-08-19T07:50:55Zoptimization error ,when i used fmincon for three variables,getting same intial guess value in resultclear all
close all
xo=[0.0011,0.0049,0.36]; % assumptions
%nvars=5;
A=[];
b=[];
Aeq=[];
beq=[];
lb=[0.001,0.002,0.01]; %lower bound
ub=[0.01,0.08,0.5]; %upper bound
nonlincon = @(X)constraint_new(X); % calling constraint function
Fitnessfun=@(X)weight_testvariable(X); %calling objective function
options = optimoptions(@fmincon,'Display','iter-detailed','Algorithm','sqp','MaxIterations',1500)
[X,fval]=fmincon(Fitnessfun,xo,[],[],[],[],lb,ub,nonlincon,options)
baically i got same value of my intial guess value,not all only 1st and 3rd variables.i know these value depend on constraint and objective functionRAHUL KUMARhttps://se.mathworks.com/matlabcentral/profile/authors/15419640-rahul-kumartag:se.mathworks.com,2005:Question/4762152019-08-15T04:05:06Z2019-08-19T07:49:16ZCan I implement a controller that uses an external physical device to control the simscape physical model motion?Can I implement a controller that uses an external physical device to control the simscape physical model motion?leihttps://se.mathworks.com/matlabcentral/profile/authors/15874132-leitag:se.mathworks.com,2005:Question/4764802019-08-17T02:31:23Z2019-08-19T07:46:52ZHow to adjust initial size and position of .exe window created by mcc?When clicking on a standalone application generated by mcc command, I find that the size of the DOS window may not be big enough to show everything.
Is there any way to predefine the size of this window and the position where it pops out?Renyihttps://se.mathworks.com/matlabcentral/profile/authors/5579730-renyitag:se.mathworks.com,2005:Question/4766462019-08-19T06:44:02Z2019-08-19T07:46:22ZHow to get an output data from a GUI popup menu to use as data in .m file.
From the popupmenu created in GUIDE, I want to get the data choosen by the user for Month and feeder and use it as an input data to my separate .m file.Maria Patihttps://se.mathworks.com/matlabcentral/profile/authors/15889352-maria-patitag:se.mathworks.com,2005:Question/4765032019-08-17T11:38:59Z2019-08-19T07:42:46ZStore function in an arrayHi every one, i have a problem in my MATLAB code that i want to store user defined functions in an array(6x6) and use this array for calculation such as take its determinant and solve the det = 0 equation. Example as code below
A = @(c) 3.*c +1;
B= @(c) [A A A;...
A A A;...
A A A];
C= @(c) det(B);
D= fsolve(C,1)
But it got this error:
Undefined function 'det' for input arguments of type 'function_handle'.
Error in Untitled>@(c)det(B)
Error in fsolve (line 230)
fuser = feval(funfcn{3},x,varargin{:});
Error in Untitled (line 4)
D= fsolve(C,1)
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
Can any one help me to solve this problem..thanks you so much!Ductho Lehttps://se.mathworks.com/matlabcentral/profile/authors/13332101-ductho-letag:se.mathworks.com,2005:Question/4763242019-08-15T22:42:29Z2019-08-19T07:37:31ZFit NonLinearLeastSquares to data and constrain curve to pass through point (0,1)I have data I need to fit to an equation, which I can do, but I want the equation to pass through point (0,1).
The equation is an exponential y = a*exp(-x/b)+ c*exp(-x/d)+ e
Currently, this is my code:
f3 = fitoptions('Method','NonlinearLeastSquares','Startpoint',[1,100,1,100,1])
newrelax = fittype('q*exp(-x/r)+ s*exp(-x/t)+u','options',f3);
[h,gof] = fit(timeR,stressR,newrelax)
plot(h,timeR,stressR)
Thank you,
-ZachZachary Nunnhttps://se.mathworks.com/matlabcentral/profile/authors/13246392-zachary-nunntag:se.mathworks.com,2005:Question/4766292019-08-19T03:37:31Z2019-08-19T07:37:31ZDoes the use of latency in statflow state work as expected?Hi, I have a problem with stateflow, which is if I use a delay function in the state to execute two sentences, does that delay function work?
Because the compilation prompted me to delete, so I hope you help me,thanks!
This temporal logic expression has no side-effect. It either needs to be used in an expression, or removed if deemed unnecessary. State 'init' in Chart 'BLDDPM_cpu1_CCP_V1_0_20190818/extraControl/Protect_Logic': after(1,sec)；
Xu Liuhttps://se.mathworks.com/matlabcentral/profile/authors/15107939-xu-liutag:se.mathworks.com,2005:Question/4763152019-08-15T20:40:57Z2019-08-19T07:37:21Z[App Designer] Can an app accept variables from the base workspace as input arguments?I'm working on an App Designer app. I'd like it to be able to pull in certain variables from the base workspace when the app is loaded and use those to determine what app startup functions are necessary. (In other words, if X and Y are already stored in certain variables in a base function, pre-populate the values of X and Y in the app on startup.)
I have input arguments set up in the app via startupFcn(). From what I can tell, even after the app is opened, if you want the app to run with certain input arguments, you have to use the Run command in App Designer and add the appropriate input arguments at runtime. I would like to combine these steps and just call the app to run and enter the input arguments during the appdesigner() call. Is this possible?
Potential workaround: For the variables I want to share with the app, make them globals. Then the app would be able to interact with them immediately, assuming the app knows the right variable name to use. Would that work?Chris Naberhttps://se.mathworks.com/matlabcentral/profile/authors/15424436-chris-nabertag:se.mathworks.com,2005:Question/4763752019-08-16T09:34:16Z2019-08-19T07:33:14Zconstrain optimization, converged to an infeasible pointHi
When I run the attached .m file, which is a fmincon function, with a nonlinear equality constraint, however, the result converged to an infeasible point, could anyone help me...
Norm of First-order
Iter F-count f(x) Feasibility Steplength step optimality
0 4 2.570732e-02 3.787e+07 5.073e+07
Objective function returned complex; trying a new point...
1 18 3.044897e-03 3.008e+07 4.035e-02 4.083e-05 1.691e+07
2 23 9.626713e-03 3.481e+06 7.000e-01 3.194e-05 2.480e+07
3 32 1.044105e-02 2.114e+06 2.401e-01 2.349e-06 2.195e+07
4 36 1.044105e-02 2.114e+06 4.900e-01 8.375e-07 2.195e+07
Converged to an infeasible point.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance but constraints are not
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
Attached will be my codes, could anyone help me get this out.
% define the function myPdc
function [Pdc]=myPdc(x)
E=169e9;
t=1.5*1e-6; %m
Q=1.33e4;
pi_n=-102*1e-11; %Pa-1
Rho_e=1e-4; %0.1 omega.m
omega=2*pi*10*1e6; % resonate frequency 10 MHz
Cv=702; %J/(kg*K)
gamma=113; %W/(m*K)
alpha=2.6e-6; %1/K
k=2*alpha*Rho_e*pi_n*E;
lamda=sqrt(gamma/(omega*Cv))*sqrt(-1i);
g=lamda^2/gamma*(1-2*lamda/x(2)*tanh(x(2)/(2*lamda)));
A=real(g);
B=imag(g);
a=x(1)*omega^2*(A^2+B^2)*k^2;
b=-2*Q*E*x(3)*t*k*B/x(2)+2*x(1)*omega^2*k*A;
c=x(1)*omega^2;
Jdc2=(-b-sqrt(b^2-4*a*c))/(2*a);
Pdc=2*Jdc2*x(3)*t*Rho_e*x(2);
end
% define the constraint
function [c,ceq]=mycon(x)
E=169e9;
t=1.5*1e-6;
omega=2*pi*10*1e6; % resonate frequency 10 MHz
c=[]; % no nonlinear inequality constraint
ceq=sqrt(2*E*x(3)*t/(x(1)*x(2)))-omega; % nonlinear equality constraint
end
% define the main function
x0=[1e-11,5e-6,1e-6];
A=[];
b=[];
Aeq=[];
beq=[];
% vlb=[];
% vub=[];
vlb=[1e-15,1e-9,1e-9];
vub=[1e-7,1e-3,1e-3];
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
[x,fval]=fmincon('myPdc',x0,A,b,Aeq,beq,vlb,vub,'mycon',options);
Thanks for help..,Sen XUhttps://se.mathworks.com/matlabcentral/profile/authors/15966692-sen-xutag:se.mathworks.com,2005:Question/4764262019-08-16T15:48:44Z2019-08-19T07:26:16ZNeed help to put condition in my optimization functionHere is my code:
function T0=tw0Solve(t1,s1,s2,rho,P)
T0= fsolve(@(tw0) (exp(-s2.^2./2).*exp(tw0.*s2).*(1-qfunc((t1-s1-rho.*tw0+rho.*s2)./sqrt(1-rho.^2)))./(1-qfunc((t1-rho.*tw0)./sqrt(1-rho.^2))))-P,rand);
end
Where for a given t1 we are trying to find tw0 that minimizes the function T0. But for some initial value the qfunc((t1-s1-rho.*tw0+rho.*s2)./sqrt(1-rho.^2)) becomes =1 which starts to provide error in fsolve as i start to get 0/0 form. How can I put a condition in this that helps me do something like this while it searches for tw0 and encounters a 0/0 form .
if qfunc(t1,tw0) < -3
T0=()
else
T0=()
endShailee Yagnikhttps://se.mathworks.com/matlabcentral/profile/authors/11759058-shailee-yagniktag:se.mathworks.com,2005:Question/4765892019-08-18T14:40:12Z2019-08-19T07:25:41Zhow can i generate random number divided by 0.25 from 0 to 10 for example(0.25,7.75,5.50,6.25 ,........)? for example(0.25,7.75,5.50,6.25 ,........)sara anwerhttps://se.mathworks.com/matlabcentral/profile/authors/12123545-sara-anwertag:se.mathworks.com,2005:Question/4763602019-08-16T08:08:58Z2019-08-19T07:21:23Z'σ' is not a valid table variable name.I got this error when I wants to use 'σ' as variable name, is not a valid table variable name.
I have used these commands as I do no have excel on my Linux pc.
tbl = array2table(TABLE);
writetable(tbl,'TABLE.xls')
This works but I get this as headers
TABLE1 TABLE2 TABLE3 TABLE4 TABLE5 TABLE6 TABLE7 TABLE8 TABLE9 TABLE10 TABLE11
not this
{'information'} {'EER'} {'σ'}
But if I change the variable name to this {'information'} {'EER'} {'σ'} I get this error
'σ' is not a valid table variable name.
How can I use 'σ' as variable name as this is possible in windows with excel and xlswrite.
Knut Jørgenhttps://se.mathworks.com/matlabcentral/profile/authors/3237246-knut-jorgentag:se.mathworks.com,2005:Question/4762562019-08-15T12:19:48Z2019-08-19T07:21:17ZRegeneration of signal using different Intrinsic Mode Function Components.I am facing difficulty in how to recreate the original signal again by using 3,4 or 5 or more Intrinsic Mode Fucntion components ? Please guide me.Sumair Hassanhttps://se.mathworks.com/matlabcentral/profile/authors/14547944-sumair-hassantag:se.mathworks.com,2005:Question/4763902019-08-16T11:39:13Z2019-08-19T07:20:14ZHow to close the boundary of a surface already generated by filling the holesfrom give matrix (attached), i am using following code to close the surface and to make a boundary but i am getting errors that indexing is out of bound.
m = zeros(28)
m = load('Matrix_Boundary_fills_3s_only.txt');
[rows, colms] = size(m);
mOut = m;
for row = 2 : rows
%
for colm = 1:colms
if m(row-1, colm) == 3
mOut(row, colm+1) = 3;
end
if m(row-1, colm) == 3 || m(row-1,colm+2) == 3
mOut(row, colm+1) = 3;
end
if m(row-1, colm + 1) == 3
mOut(row, colm+1) = 3;
end
end
end
% end
disp(mOut)
thanks for all cooperation in advance. M.S. Khanhttps://se.mathworks.com/matlabcentral/profile/authors/13647580-m-s-khantag:se.mathworks.com,2005:Question/4759702019-08-13T12:36:42Z2019-08-19T07:18:51ZHow to extract data from multiple excel filesI am attempting to create a 3D map of 101 sets of data, each set is in a seperate excel spreadsheet, all sets are within 1 folder.
My MatLAB knowledge is minimal, but this is my attempt at the code:
nFiles=101
filenamePrefix='F1--Trace-no loop-0000--0000';
filenameExtension='.csv';
for i = 1:nFiles
filename = [filenamePrefix, int2str(i), filenameExtension];
tmpData = readmatrix(filename, 'NumHeaderLines',1)
x{i}=tmpData(:,1);
y{i}=tmpData(:,2);
end
mesh(x{i},y{i},i}
Please give any advice or alternative codes that could work
Simon Mendumhttps://se.mathworks.com/matlabcentral/profile/authors/15945575-simon-mendumtag:se.mathworks.com,2005:Question/4766512019-08-19T07:17:52Z2019-08-19T07:18:21ZHow to calculate Nearest neighbor of Image after applying PCA on Image. Hi all, I am working on yale face data set till now what I have done is below. I am taking only 15 images ( all are different, just for testing) . What steps I have follow are as follows -
apply PCA on an Image
find nerest neighbour of image after applying PCA.
find diagonal matrix
find laplacian matrix
find (Diagonal^-1 * laplacian matrix)
find eigen value.
Only issue am facing is how to find nearest neighbour of image after PCA.
D = 'Happy';
S = dir(fullfile(D,'*.jpg')); % pattern to match filenames.
%%
for n=1:numel(S)
im = imread(S(n).name); %read image
[rows, columns, numberOfColorBands] = size(im);
im = im2double(rgb2gray(im)); % convert image to gray scale and then to double precision
[r,c] = size(im); % get number of rows and columns in image
I(:,n) = im(:); % convert image to vector and store as column in matrix I
end
%%
% I=imread('subject01 happy.jpg');
% b=double(rgb2gray(I));
%%
[rows, columns, numberOfColorBands] = size(I);
X = double(reshape(I, rows * columns,1));
%%
coeff = pca(I);
%%
Itransformed = I * coeff;
%%
uyt={};
for i=1:15
pca1Image = reshape(Itransformed(:,1), rows, columns);
uyt{i}=pca1Image;
end
After this( Itransformed = I * coeff) I have a matrix of (50176x15 double) and a structure uyt with 224*224 image regenrated .
Now I have to calculate nearest neighbour of image after this PCA image . For finding nearest neighbour we need a query data in knn function but what will the quest data for image in PCA matrix.
Or I may be wrong in my approch .
Please help me .
kaushal sharmahttps://se.mathworks.com/matlabcentral/profile/authors/6564090-kaushal-sharmatag:se.mathworks.com,2005:Question/4758042019-08-12T10:37:06Z2019-08-19T07:13:30ZGet next or prior single precision value MATLAB function ?Is there a MATLAB function for next or prior float32 number ?
(similar to nextafterf, nexttowardf or float_next, float_prior)
tried these functions:
function [out] = next_SP(val)
% Get next after SP value - float32, single precision
% Increment float with smalllest step, SP representable
% TODO check for sign changes, domain INF NAN subnormals changes,
% uint32 ovf realmax + 1, mantissa exp changes
% Check nextafterf from math.h
% The nextafter() functions return the next representable floating-point
% value following x in the direction of y. If y is less than x, these
% functions will return the largest representable number less than x.
% If x equals y, the functions return y.
% https://www.boost.org/doc/libs/1_46_1/libs/math/doc/sf_and_dist/html/math_toolkit/utils/next_float/float_next.html
% Returns the next representable value which is greater than x.
% If x is non-finite then returns the result of a domain_error.
% If there is no such value greater than x then returns an overflow_error.
int_v = typecast(single(val), 'uint32' );
%disp([ 'Init ' num2str(single(val)) ' 0x' num2hex(single(val)) ', ' dec2bin(int_v, 32) ]);
int_v = int_v + 1;
out = typecast(uint32(int_v), 'single' );
%disp([ 'Init ' num2str(out) ' 0x' num2hex(out) ', ' dec2bin(int_v, 32) ]);
end
and
function [out] = prior_SP(val)
% Get next before SP value - float32, single precision
% Decrement float with smalllest step, SP representable
% TODO check for sign changes, domain INF NAN subnormals changes,
% uint32 udf realmax + 1, mantissa exp changes
% Check nexttowardf from math.h
% https://www.boost.org/doc/libs/1_48_0/libs/math/doc/sf_and_dist/html/math_toolkit/utils/next_float/float_prior.html
% Returns the next representable value which is less than x.
% If x is non-finite then returns the result of a domain_error.
% If there is no such value less than x then returns an overflow_error.
int_v = typecast(single(val), 'uint32' );
%disp([ 'Init ' num2str(single(val)) ' 0x' num2hex(single(val)) ', ' dec2bin(int_v, 32) ]);
int_v = int_v - 1;
out = typecast(uint32(int_v), 'single' );
%disp([ 'Init ' num2str(out) ' 0x' num2hex(out) ', ' dec2bin(int_v, 32) ]);
end
nexttoward_SP(-0)
Init 0 0x80000000, 10000000000000000000000000000000
Init NaN 0x7fffffff, 01111111111111111111111111111111
nexttoward_SP(0)
Init 0 0x00000000, 00000000000000000000000000000000
Init 0 0x00000000, 00000000000000000000000000000000
nexttoward_SP(-inf)
Init -Inf 0xff800000, 11111111100000000000000000000000
Init -3.402823466385289e+38 0xff7fffff, 11111111011111111111111111111111
nexttoward_SP(Inf)
Init Inf 0x7f800000, 01111111100000000000000000000000
Init 3.402823466385289e+38 0x7f7fffff, 01111111011111111111111111111111
nexttoward_SP(nan)
Init NaN 0xffc00000, 11111111110000000000000000000000
Init NaN 0xffbfffff, 11111111101111111111111111111111
(maybe similar for half or double precision)
Firan Lucianhttps://se.mathworks.com/matlabcentral/profile/authors/11849913-firan-luciantag:se.mathworks.com,2005:Question/4766482019-08-19T06:59:32Z2019-08-19T07:10:28Zcellfunc in tables alternativeHello,
I have a problem i had run this script with xlsread, but changed it to readtable(for convenience issues), now it seems that cellfunc don't work well with tables. I'm looking for an alternative to make this work
raw = readtable('Document.xls','Sheet', sheetName,'Range', 'A:C')
[data_a,datetime_str_a] = cleanup(raw)
%%
function [data,datetime_str] = cleanup(raw)
raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''};
%% Replace non-numeric cells with NaN
R = cellfun(@(x) ~isnumeric(x) && ~islogical(x),raw); % Find non-numeric cells
raw(R) = {NaN}; % Replace non-numeric cells
%% Create output variable
I = cellfun(@(x) ischar(x), raw);
raw(I) = {NaN};
data = reshape([raw{:}],size(raw));
%% Remove empty data rows
Nrows = size(data,1);
for row = Nrows:-1:1
if all(isnan(data(row,:)))
data(row,:) = [];
else
break
end
end
%% Make date time string
% column 1 is UNIX timestamp (# seconds since 1-1-1970)
days = data(:,1)/86400; % # days since 1-1-1970
t0 = datenum('01.01.1970','dd.mm.yyyy'); % # days since 1-1-0000 (base for Matlab), plus 1 hr correction (timezone)
% t0 = datenum('01.01.1970','dd.mm.yyyy')+1/24; % # days since 1-1-0000 (base for Matlab), plus 1 hr correction (timezone)
daystot = t0+days;
datetime_str = datestr(daystot); % string (24-May-2017 08:08:02)Anthony Vermuehttps://se.mathworks.com/matlabcentral/profile/authors/11621813-anthony-vermuetag:se.mathworks.com,2005:Question/4766502019-08-19T07:10:20Z2019-08-19T07:10:20ZHow can i apply SVM or other classification methods on a cell array?I have a cell array of size 2400*5. Each cell contain double array of size 30*1. and the 5th column of each row has the label of that image. can u please suggest a method for classifiation of this type of array.Anamika jainhttps://se.mathworks.com/matlabcentral/profile/authors/12982111-anamika-jaintag:se.mathworks.com,2005:Question/4765082019-08-17T12:42:04Z2019-08-19T07:03:53ZConcatenate two audio filesI would like to concatenate two audio files such that a new audio signal is created whereby the first audio plays and this is then immedialely followed by the second.
[y1,Fs] = audioread('sample1.wav');
y1_sample_rate = 8000;
[y2,Fs] = audioread('sample2.wav');
y3 = [y1(1:y1_sample_rate,:); y2;];
What am I doing wrong?
Thank you. SBakchttps://se.mathworks.com/matlabcentral/profile/authors/14737531-sbakctag:se.mathworks.com,2005:Question/4766432019-08-19T06:16:52Z2019-08-19T06:58:46ZHow to plot a series of numbers which some of them are inf?I have a series of X and Y that some of Ys might be inf. Ys are changing in each loop there might be inf in them (more than one or none).
When I plot with plot(X,Y) function, it deos not show inf values. Any suggestion?
Zeynab Mousavikhamenehttps://se.mathworks.com/matlabcentral/profile/authors/14179884-zeynab-mousavikhamenetag:se.mathworks.com,2005:Question/4750682019-08-06T12:19:29Z2019-08-19T06:57:06ZTwo curves on different r axis in polarplotI would like to plot two curves in the same polarplot (or aný circel diagram) but on two different axis, in similar way yyaxis works for an ordinary plot.
Example of my code below. One curve (blue) on r-axis with blue labels. I would like an r-axis with red labels along another r-axis angle for the red curve.
Thanks in advance /Julia
Example code:
t = 0 : 2*pi/177 : 2*pi;
a=linspace(0.3,0.5,178);
m=linspace(0.4,0.6,178);
figure(3)
ax = polaraxes;
hold on
polarplot(ax,t,a,'-b')
polarplot(ax,t,m,'-r')
ax.RColor ='blue';
ax.ThetaDir = 'counterclockwise';
ax.ThetaZeroLocation = 'bottom';
thetaticks([0:30:360])
thetaticklabels({'180','150','120','90','60','30','0','330','300','270','240','210'})
Julia Nilssonhttps://se.mathworks.com/matlabcentral/profile/authors/5194414-julia-nilssontag:se.mathworks.com,2005:Question/4766192019-08-18T21:24:25Z2019-08-19T06:55:27ZFind intersection of two x-y tracks given time elementI have two tracks defined by x-y coordinates in which I would like to establish the crossing points. This appears to be relatively easy using several of the submissions on File Exchange such as <https://uk.mathworks.com/matlabcentral/fileexchange/11837-fast-and-robust-curve-intersections Intersection> and <https://uk.mathworks.com/matlabcentral/fileexchange/22441-curve-intersections InterX> . This submission a list of the x and y values of the crossing points. However it doesn’t take into account time. Let me explain....
Suppose my two tracks are for a cat and a mouse. The tracks explain where both the cat and mouse have been as a function of time using x-y coordinates. Let’s now suppose that I know that the cat always trails the mouse - that is to say that the mouse is always ahead of the cat as a function of time, never the other way round. Is there a quick way (like the File Exchange link I show) to calculate only crossing points where the cat crosses the mouses trail, not the mouse crossing the cats trail.
One solution would be to return x-y-time triplets which I could then filter to ensure the cat is behind the mouse. But I’m not sure how I could make a fast running function of this nature Mark Jacksonhttps://se.mathworks.com/matlabcentral/profile/authors/4946998-mark-jacksontag:se.mathworks.com,2005:Question/4766412019-08-19T06:06:33Z2019-08-19T06:55:13ZFit differential equation to a curveHi,
I have an equation dc/dt = 6k1 - k1c - k2c^2
I need to find the values of k1 and k2 from the plot data:
t = [5 10 20 30 45 60 90 120];
c = [4.83 3.87 2.54 2.08 1.82 1.8 1.76 1.74];
How do I go about this?
Thanks for your help.Titas Debhttps://se.mathworks.com/matlabcentral/profile/authors/15952694-titas-debtag:se.mathworks.com,2005:Question/4755272019-08-09T09:59:26Z2019-08-19T06:53:32ZHow to simulate and verify a dc motor performance on simscape Hi everyone,
i'm trying to verify if a dc motor+transmission system is suitable for an application and if the force that is actuated is enough.
To be precise enough what could be the suitable way to verify if the force is enough? the first problem is the simulation of the load, that is a load that increase up to 200 N in a space of 3 mm and reched this peak, goes down quite vertically.
Do you some advice for me? i'm quite a beginner with matlab and simscape, so i hope to get some advices.
Thanks in advance.Andrea Ongarohttps://se.mathworks.com/matlabcentral/profile/authors/11137946-andrea-ongarotag:se.mathworks.com,2005:Question/4748482019-08-05T05:59:39Z2019-08-19T06:51:10ZTraining YOLO V2 with multiple (more than one) classesHi all,
When I train YOLOV2 with single class (person) using trainYOLOv2ObjectDetector, I can get precision/recall of 0.92 but when I add another class (car) with same images and just few car labels, the accuracy is 0, meaning even the person cannot be detected in any of the images even my training images!
I even use AnchorBox estimation and treid many times.
All the matlab examples are tarined only on single objects but how about if we have more than one class to be trained? Does anyone have any success to help me please?Zahra Moayedhttps://se.mathworks.com/matlabcentral/profile/authors/11782601-zahra-moayedtag:se.mathworks.com,2005:Question/4763052019-08-15T18:30:43Z2019-08-19T06:46:25ZAdd title to one row of a subplot I am using subplot and there 6*2. I want to add title for every two plots that are in the same row.
Any suggestion?
Zeynab Mousavikhamenehttps://se.mathworks.com/matlabcentral/profile/authors/14179884-zeynab-mousavikhamenetag:se.mathworks.com,2005:Question/4759812019-08-13T13:43:16Z2019-08-19T06:46:10ZPerforming operations on row elements in a matrixSo I'm creating some simple examples on trying to perform operations between rows in a matrix such as division. I have a matrix where:
my_mat = [2 4 6 8; 4 8 12 16]
which looks like so when printed.
my_mat =
2 4 6 8
4 8 12 16
and what I'm trying to do now is to divide the elements of the first row with the corresponding neighbouring ones which is the second row in this case since it's only a 2x4 matrix. This means 2/4, 4/8, 6/12 and 8/16
Then perhaps printing out the result as the output
0.5
0.5
0.5
0.5
How do i perform row operations in a single matrix?
I've looked into bsxfun but apparently i can't figure out the way to perform row operations with it.Stewart Tanhttps://se.mathworks.com/matlabcentral/profile/authors/15900511-stewart-tantag:se.mathworks.com,2005:Question/4766472019-08-19T04:00:00Z2019-08-19T06:45:06ZHow do I upgrade my MATLAB Production Server installation to a new release?I want to upgrade my MATLAB Production Server installation to a newer release. What do I have to do exactly? What can I reuse from my old installation and setup?
MathWorks Support Teamhttps://se.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:se.mathworks.com,2005:Question/4763072019-08-15T18:38:18Z2019-08-19T06:44:22Zhow to construct a cell array from another cell arrayI have a cell array with a variable number of cells and a variable number of elements within each cell. For instance, it could by V{1}{1}=1 2 3 4, V{1}{2}=3 4 1 0,V{1}{3}=3 5 -1 -9, and V{2}{1}=-1 -2 9, V{2}{2}= 0 9 6, i.e., the cell 1 has 3 vectors of length 4 elements and the cell 2 has 2 vectors of length 3. I want to construct another cell array such that it has all combinations of these vectors, here I could have 6 combinations (3*2=6). The new cell array has to be of length 6 cells (number of possible combinations), and each cell has a possible combinations, for example A{1}={1 2 3 4 and -1 -2 9} and A{2}={1 2 3 4 and 0 9 6} . Note that I will get these vectors from a matlab code so I do not know them in advance.mohamed alzenadhttps://se.mathworks.com/matlabcentral/profile/authors/2662492-mohamed-alzenadtag:se.mathworks.com,2005:Question/4069382018-06-22T11:40:15Z2019-08-19T06:41:39ZFitting the numerical solution of a PDE with one parameter to some dataI need to fit the numerical solution of a PDE with one parameter to some data in MATLAB.
I already solved the PDE (by giving an arbitrary value to the parameter) and I have the data, but I am not sure if I can use |nlinfit|, since it requires an analytic function as input.
Another issue is how to pass the parameter to be fitted to |pdepe| to solve the PDE.matnewbiehttps://se.mathworks.com/matlabcentral/profile/authors/5913505-matnewbietag:se.mathworks.com,2005:Question/4765932019-08-18T14:59:05Z2019-08-19T06:39:32ZAuto close uifigure upon deletion of handle from workspaceI have a GUI class that creates an uifigure (see below), I can create an instance of this class in my workspace:
tG = testGUI('hi!');
I can close the GUI by calling the delete method: tG.delete(). Is it also possible to automatically close the GUI when the handle tG is cleared from the workspace by e.g. clear tG;? This would prevent opening many instances of the class when running some script multiple times, while the handle to the GUI is already deleted.
Update
I see my previous example did not really reflect what I am trying to achieve. The thing is that I need to keep a handle to the instance, to call a method to add data to the instance (and later visualize this data in the GUI, not shown below):
tg.add_data(rand(10),1);
So, when I am done with one script, in which I add data, manipulate this data from the GUI, and then save the data, I'd like to start a fresh instance.
I tried adding the following to the top of my script
try
close(lg)
catch ME
disp(ME)
end
clear
close all
% start stuff
lg = testGUI('Hi');
for k = 1:10
lg.add_data(rand(10), k);
end
But when the handle is accidentally cleared from my workspace, this does not work anymore, and again a new GUI is opened.
Example GUI:
classdef testGUI < matlab.apps.AppBase
properties (Access = public)
% The figure handle used.
UIFigure
% app name
name
% some data (matrix as a simple example)
data_matrix
end
properties (Access = private)
pushButton
end
methods (Access = public)
function app = testGUI(name)
%TESTGUI - Constructor for the testGUI class.
% property management
app.name = name;
app.data_matrix = NaN(10,10,5); % init the data matrix
% create GUI components
createComponents(app)
% Register the app with App Designer
%registerApp(app, app.UIFigure); % removing this does not solve the issue
end
function delete(app)
delete(app.UIFigure)
end
function add_data(app, dataIn, n)
% add some data
app.data_matrix(:,:,n) = dataIn;
end
end
methods (Access = private)
function createComponents(app)
%Create the components of the GUI
app.UIFigure = uifigure('Name', app.name);
app.UIFigure.Visible = 'on';
% some button
app.pushButton = uibutton(app.UIFigure, 'push');
app.pushButton.Text = 'This is a button';
app.pushButton.ButtonPushedFcn = @(src,event) someCallBack(app);
end
function someCallBack(app)
fprintf('this is someCallBack\n')
end
end
end
rickerthttps://se.mathworks.com/matlabcentral/profile/authors/4538872-rickerttag:se.mathworks.com,2005:Question/4766382019-08-19T05:03:59Z2019-08-19T06:39:01ZError while evaluating DestroyedObject CallbackHello everyone, I'm having an error when i press a button from the gui that i had created
This is My coding :
readRpost = im2bw(oimg2);
readGT = im2bw(oimg1);
TP = 0;
TN = 0;
FP = 0;
FN = 0;
[row, column]= size(readGT);
gt_baru = readGT;
for i=1: row
for j=1:column
pixel_1 = gt_baru(i,j); % ground truth segmentation image
pixel_2 = readRpost(i,j); % output segmentation
% true positive==> if ground truth is positive and proposed algorithm output is positive
if pixel_1 == 1 && pixel_2 ==1
TP = TP+1;
end
% false negative==> if ground truth is positive and proposed algorithm output is negative
if pixel_1 == 1 && pixel_2 ==0
FN = FN+1;
end
% True negative==> if ground truth is negative and proposed algorithm output is negative
if pixel_1 == 0 && pixel_2 ==0
TN = TN+1;
end
% false positive==> if ground truth is negative and proposed algorithm output is positive
if pixel_1 == 0 && pixel_2 ==1
FP = FP+1;
end
end
end
add = TP+FP+TN+FN
sze = row*column
if add==sze % sepatutnya jumlah keseluruhan adalah sama kerana ia dievaluate pixel by pixel
% formula error
precision = TP/(TP+FP)
sensitivity = TP/(TP+FN)
specificity = TN/(TN+FP)
accuracy = (TP+TN)/(add)
PPV = TP/(TP+FP) % Positive Predictive Value
NPV = TN / (FN + TN) % Negative Predictive Value
error = (FP+FN)/(add)
else
disp ('error in calculation')
end
% end
% save performanceMeasurement precision sensitivity specificity accuracy PPV NPV error '-append'
set(handles.text10, 'string', accuracy);
set(handles.text11, 'string', sensitivity);
set(handles.text12, 'string', specificity);
The error:
Reference to a cleared variable oimg2.
Error in image_processing2>pushbutton5_Callback (line 368)
readRpost = im2bw(oimg2);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in image_processing2 (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)image_processing2('pushbutton5_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating DestroyedObject Callback
I really appreciate if someone can help meNazirul Hafizhttps://se.mathworks.com/matlabcentral/profile/authors/14343626-nazirul-hafiztag:se.mathworks.com,2005:Question/4765732019-08-18T10:49:06Z2019-08-19T06:37:02Zhow to enter function into app designer ? So I want to use UART prtocol into my project . I build the UART protocol ,but I want to use this protocol via appdesigner . So for exmaple I want to write the number In a Numeric Field box and to send this number to the UART protocol . how do I do it ?
this is my UART protocol :
%% Instrument Connection
% Find a serial port object.
obj1 = instrfind('Type', 'serial', 'Port', 'COM3', 'Tag', '');
% Create the serial port object if it does not exist
% otherwise use the object that was found.
if isempty(obj1)
obj1 = serial('COM3');
else
fclose(obj1);
obj1 = obj1(1);
end
% Connect to instrument object, obj1.
fopen(obj1);
%%% Instrument Configuration and Control\
% Communicating with instrument object, obj1.
fwrite(obj1,23 , 'uint8');
in this last line of code :
fwrite(obj1,23 , 'uint8');
I send the number that I want to send in the UART protocol . But I want to enter this number (for example 23 in this case ) via NumericEditField in the app designer . How to do it ?
tomer polskyhttps://se.mathworks.com/matlabcentral/profile/authors/12906803-tomer-polskytag:se.mathworks.com,2005:Question/4763942019-08-16T12:09:24Z2019-08-19T06:36:35ZMatrix Multiplikation Speed Up Hello, I would like to speed up this code, any sugestions
Rm, Zm and Cm are 1700x1700
f = linspace(1e3,5e6,750); % Hier gibt man den Frequenzbereich an
w = 2*pi*f';
parfor k=1:length(f)
Zm = Rm+w(k)*1i*Lm;
Gama = Kk*(Zm\Kkt);
YYn = w(k)*1i*Cm + Gama;
Zn = inv(YYn);
Amp(k) = abs(1-Zn(jj,1)/Zn(1,1));
end
I do not have a GPUMatthias Schneiderhttps://se.mathworks.com/matlabcentral/profile/authors/9828496-matthias-schneidertag:se.mathworks.com,2005:Question/4750192019-08-06T06:54:40Z2019-08-19T06:34:04ZODE for 2 variablesHello all,
Does matlab support DE of this type: d(xy)/dt (ie. y dx/dt + x dy/dt)? If so how to werite these type of equations? I am a new comer to matlab and any help would be great!
Thanks.Nivedhitha Shttps://se.mathworks.com/matlabcentral/profile/authors/14653675-nivedhitha-stag:se.mathworks.com,2005:Question/4755312019-08-09T10:24:10Z2019-08-19T06:30:04ZHow to write and solve this pde system<</matlabcentral/answers/uploaded_files/233325/Screenshot_%D9%A2%D9%A0%D9%A1%D9%A9%D9%A0%D9%A8%D9%A0%D9%A9_%D9%A1%D9%A3%D9%A1%D9%A8%D9%A3%D9%A2.jpg>>
Ahmed Alihttps://se.mathworks.com/matlabcentral/profile/authors/15932704-ahmed-alitag:se.mathworks.com,2005:Question/4766452019-08-19T06:25:30Z2019-08-19T06:27:12ZSurface plots inside loopHi,
I am working on a code that approximates a general bivariate function using a piecewise linear bivariate function. I am able to retrieve the data and plot it, my code works as follows:
It plots one subdomain at a time, as a surface plot. The plot is put inside a loop and so during each, iteration a new subdomain is plotted.
The issue here is that the final plot is displayed with discontinuities as shown in the figure attached.
Kindly help me remove those discontinuities, so as to make the final plot solid or suggest any alternate idea that would work.Mahesh M Shttps://se.mathworks.com/matlabcentral/profile/authors/14352953-mahesh-m-s