https://jp.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — 新規の質問2019-04-18T13:04:32Ztag:jp.mathworks.com,2005:Question/4571652019-04-18T12:43:17Z2019-04-18T13:04:32ZReturn back to a specific lineI have more while and for loop, I need to go beginning. ex:
1. while ()
2. for ()
3. if (condition)
4. Go back to starting of the code i.e line 1
5. else
6. code for some action
7. end
8. end
8. for ()
9. some calculation
8. end
9. end
I need like this, Please help. If I use break, it will break that first for loop only and it will go to next for loop, but I don't want that.Arnab Palhttps://jp.mathworks.com/matlabcentral/profile/authors/8559237-arnab-paltag:jp.mathworks.com,2005:Question/4570192019-04-17T19:19:23Z2019-04-18T13:01:18ZHow fmincon shifts x0 when it does not strictly satisfy the upper and lower bounds?When you get the following message in running fmincon:
Your initial point x0 is not between bounds lb and ub; FMINCON
shifted x0 to strictly satisfy the bounds.
How the x0 is shifted? Is it a reproducible shift? Can the shifted x0 be recorded?babak naghizadehsafahttps://jp.mathworks.com/matlabcentral/profile/authors/6901089-babak-naghizadehsafatag:jp.mathworks.com,2005:Question/4571732019-04-18T13:00:27Z2019-04-18T13:00:27ZStiff Delay Differential EquationsHey
Can we use dde23 solver for solving sytem of stiff delay differential equations?
I tried to find the solution of those equation by using dde 23 but MATLAB is showing 'busy' string.parag guptahttps://jp.mathworks.com/matlabcentral/profile/authors/9570620-parag-guptatag:jp.mathworks.com,2005:Question/4571722019-04-18T12:58:40Z2019-04-18T12:58:40Zhow can i plot a half sine wave plot or a cosine wave which has a origin as a centre ?can we plot a sine wave which half wave i.e. positive side only
can we plot same sine wave in reverse direction from above plot
what can i use if exist either matlab .m file or simulink
or
how can i plot a cosine wave which has a centre on origin sesha saihttps://jp.mathworks.com/matlabcentral/profile/authors/13891845-sesha-saitag:jp.mathworks.com,2005:Question/4571712019-04-18T12:55:47Z2019-04-18T12:55:47ZCalculating eigenvalues of matrices of symbolic matrices Dear all,
I have the following matrix of symbolix matrices:
[0 0 0;
0 -(D_2*N_1)^(-1)*D_2*N_2-(D_2*N_1)^(-1)*D_2*N(I-B_2*(D_1*B_2)^(-1)*D_1);
0 B_1-A_12*(I-N_1*(D_2*N_1)^(-1)*D_2)*N_2 (A_11-A_12*N + A_12*N_1*(D_2*N_1)^(-1)*D_2*N)*(I-B_2*(D_1*B_2)^(-1)*D_1)]
where * is the matrix product operator, ^(-1) is the matrix inverse operator and 0 is a matrix of zeros.
I want to know if there is a way of:
1) Using matlab to symplify the expression
2) Calculating the eigenvalues of this matrix
Any input is appreciated, many thanks!Luciano Rispolihttps://jp.mathworks.com/matlabcentral/profile/authors/11598488-luciano-rispolitag:jp.mathworks.com,2005:Question/4571702019-04-18T12:54:37Z2019-04-18T12:54:37Zhow can i made an atom simulation in matlabhi everyone. i have to prepare basic atom simulation but im new to matlab. so i have no idea. what should i do? where should i start? please help me.mdln3https://jp.mathworks.com/matlabcentral/profile/authors/15311531-mdln3tag:jp.mathworks.com,2005:Question/4571692019-04-18T12:54:14Z2019-04-18T12:54:14ZHow to compute the homography Dear Community,
I have some issue to getting the trasnform image for homography
I want to apply the homography to an image, I do have homography martix from the general formulation
H = R+1/d*n*t'
H = rotation_matrix + t.* Normal
H =
0 -1.0000 0
-0.3420 0 -0.9397
5.9397 5.0000 4.6580
The basic concept of idea is to trying get image from vitrual camera, so the question I that how I can get the image from virtual camera ?
As you can see figure below , I have perspective image but I want to use inverse perspective mapping
Thanking you so much
Sushil Sharmahttps://jp.mathworks.com/matlabcentral/profile/authors/14231039-sushil-sharmatag:jp.mathworks.com,2005:Question/4565312019-04-15T17:49:53Z2019-04-18T12:52:51ZHow to use rosgenmsg with a filepath on a separate computer?My Setup:
I have created a custom service (.srv in the srv folder of the desired package) on my main machine (Ubuntu 16.04/ ROS Kinetic/ ROS master on this one). I have Matlab on another computer (Windows 10). The windows computer has full connectivity with ros on the linux computer (Matlab can publish and subscribe to topics and call services through the robotics system toolbox).
My Question:
How do I have Matlab call the rosgenmsg(), a function that generates a Matlab object file from .srv or .msg files, with a file path to a package on a separate computer?Theodore Chasehttps://jp.mathworks.com/matlabcentral/profile/authors/13160469-theodore-chasetag:jp.mathworks.com,2005:Question/4571682019-04-18T12:52:31Z2019-04-18T12:52:31ZCI for normalized dataHey everyone,
I am trying to fit confidence intervals to a hill slope I had previously generated. However the data I am using had to be normalized and because of this the confidence intervals are falling below 0% or above a 100% which isn't possible. Is there anyway to anchor the confidence intervals so to speak?
Thanks!Caitlin Newmanhttps://jp.mathworks.com/matlabcentral/profile/authors/10641825-caitlin-newmantag:jp.mathworks.com,2005:Question/4571602019-04-18T12:09:49Z2019-04-18T12:51:58ZLinearization of points problemHello,
I have some data dots which I would like to linearize, however my code is not working.
aMID=[1.780287,3.672423,5.370854,5.363762,7.969255,8.148480,8.374100,10.029387,10.580805,10.781898]
aVenturi=[0.015449,0.032720,3.424873,3.473750,7.594966,6.521211,9.006245,11.045405,11.462227,11.935103]
figure(2)
linsys=linearize(aMID,aVenturi)
plot(aMID,aVenturi,'Marker','o')
hold on
plot(aMID,linsys)
So as you can see, I want to linearize the dots of aVenturi, but it does not work, what am I doing wrong?
Thank you so much for the support!Josefina Ottitschhttps://jp.mathworks.com/matlabcentral/profile/authors/13775798-josefina-ottitschtag:jp.mathworks.com,2005:Question/4567892019-04-16T21:15:41Z2019-04-18T12:48:49ZError changing data in table from char to double*See attached data set for reference
I am importing the data set and trying to change the variable type for the second column, "GROSS_QTY" from a char to a double. I am following the example Matlab published (Here - "Detect and Use Import Options for Text Files").
Here is the code:
opts = detectImportOptions('DateAndQuantity.csv');
getvaropts(opts,{'GROSS_QTY'});
opts = setvartype(opts,{'GROSS_QTY'},'double');
opts.SelectedVariableNames = {'GROSS_QTY'};
qntyTable = readtable('DateAndQuantity.csv');
summary(T)
The summary outputs the following:
Variables:
GROSS_QTY: 105x1 cell array of character vectors
Per the example provided by Matlab, that variable should be a double. Can anyone explain what is happening?Zac Lingenhttps://jp.mathworks.com/matlabcentral/profile/authors/13289644-zac-lingentag:jp.mathworks.com,2005:Question/4571662019-04-18T12:47:21Z2019-04-18T12:48:10ZHow to plot a surf-plot of semi sphere in matlab using sphere equationHi, I am trying to plot a semi sphere (with out using sphere command in Matlab) using the sphere equation ((x-a)/r)^2+((y-b)/r)^2+((z-a)/r)^2 = 1; But I am confused hot to choose x, y, z. I tried with the below code but I seem to do some thing wrong somewhere...could any one provide me with a better way to do it
x = 0:1:640;
y = 0:1:480;
[x y] = meshgrid(x,y);
z = -((x-320).^2)/(25)-((y-240).^2)/(25)-1;
z(z<0)=0;
figure();
meshc(z);
My end result should look as shown below
JAGADEESH KUMAR Mhttps://jp.mathworks.com/matlabcentral/profile/authors/12774450-jagadeesh-kumar-mtag:jp.mathworks.com,2005:Question/915182010-06-21T12:09:00Z2019-04-18T12:43:09ZWhy do I receive the error "The pointer passed to 'vector_check' is invalid" error when using mxSetPr?I am trying to use mxSetPr inside a C# application and it returns the following error:
ERROR: The pointer passed to 'vector_check' is invalid
MathWorks Support Teamhttps://jp.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:jp.mathworks.com,2005:Question/989762012-09-10T15:27:00Z2019-04-18T12:43:08ZHow can I export MATLAB figures to Excel using Excel Link?I have a MATLAB file which creates 26 figures. I would like to copy these figures as a group into an Excel file. Currently I copy and paste manually.
MathWorks Support Teamhttps://jp.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:jp.mathworks.com,2005:Question/994602009-06-27T01:11:00Z2019-04-18T12:43:07ZWhere can I find the models in the book "Using Simulink and Stateflow in Automotive applications"?I would like to get access to the models used in the book " Using Simulink and Stateflow in Automotive applications". The book mentions that these models can be found on the MathWorks FTP site at the following URL:
<ftp://ftp.mathworks.com/pub/product-info/examples/autobook.zip>
However, these models are no longer available at the mentioned FTP site.MathWorks Support Teamhttps://jp.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:jp.mathworks.com,2005:Question/1971182015-04-10T13:47:52Z2019-04-18T12:36:31ZHow can I get rid of this error.? Please help me guys
E = 10e7; poisson = 0.30;
C=E/(1-poisson^2)*[1 poisson 0;poisson 1 0;0 0 (1-poisson)/2];
P = 1e6;
Lx=5;
Ly=1;
numberElementsX=20;
numberElementsY=10;
numberElements=numberElementsX*numberElementsY;
[nodeCoordinates, elementNodes] =rectangularMesh(Lx,Ly,numberElementsX,numberElementsY);
xx=nodeCoordinates(:,1);
yy=nodeCoordinates(:,2);
drawingMesh(nodeCoordinates,elementNodes,'Q4','k-');
numberNodes=size(xx,1);
GDof=2*numberNodes;
stiffness=formStiffness2D(GDof,numberElements,elementNodes,numberNodes,nodeCoordinates,C,1,1);
% boundary conditions
fixedNodeX=find(nodeCoordinates(:,1)==0);
fixedNodeY=find(nodeCoordinates(:,1)==0); % fixed in YY
prescribedDof=[fixedNodeX; fixedNodeY+numberNodes];
force=zeros(GDof,1);
rightBord=find(nodeCoordinates(:,1)==Lx);
force(rightBord+numberNodes)=P*Ly/numberElementsY;
force(rightBord(1)+numberNodes)=P*Ly/numberElementsY/2;
force(rightBord(end)+numberNodes)=P*Ly/numberElementsY/2;
displacements=solution(GDof,prescribedDof,stiffness,force);
% displacements and deformed shape
disp('Displacements')
jj=1:GDof; format
f=[jj; displacements'];
fprintf('node U\n')
fprintf('%3d %12.8f\n',f)
UX=displacements(1:numberNodes);
UY=displacements(numberNodes+1:GDof);
scaleFactor=0.1;
figure
drawingField(nodeCoordinates+scaleFactor*[UX UY],elementNodes,'Q4',UX);%U XX
hold on
drawingMesh(nodeCoordinates+scaleFactor*[UX UY],elementNodes,'Q4','k-');
drawingMesh(nodeCoordinates,elementNodes,'Q4','k--');
colorbar
title('U XX (on deformed shape)')
axis off
% stresses at nodes
stresses2D(GDof,numberElements,elementNodes,numberNodes,nodeCoordinates,displacements,UX,UY,C,scaleFactor);
*''Undefined function or variable "nodeCoordinates".''*
*[nodeCoordinates, elementNodes] =rectangularMesh(Lx,Ly,numberElementsX,numberElementsY);*MD NAHIDUL ISLAMhttps://jp.mathworks.com/matlabcentral/profile/authors/6292913-md-nahidul-islamtag:jp.mathworks.com,2005:Question/4571632019-04-18T12:26:49Z2019-04-18T12:32:57ZRotate a set of 2D points by changing the first element into originI have a set of point, each point has 3 attributions,(x,y,direction)
such as:
(1,2,45) (5,7,50)(9,6,120)
I want to consider the first point (1,2,45) as the orgin, and scale the other two points to a new coordition system.
for x and y, I can directly minus the values of the fist point, but I don't know how to deal with the angle.
How can I implement this?
Thank you so much.
Jiajie Zhanghttps://jp.mathworks.com/matlabcentral/profile/authors/14017622-jiajie-zhangtag:jp.mathworks.com,2005:Question/4569222019-04-17T12:33:53Z2019-04-18T12:31:25Zturning legend off in xline functionHow can I turn off legend of xline function being visible on the plot?Manisha RANJANhttps://jp.mathworks.com/matlabcentral/profile/authors/3328388-manisha-ranjantag:jp.mathworks.com,2005:Question/4568302019-04-17T03:59:00Z2019-04-18T12:31:05ZMatrix problem with my vectorsI am tryin to create a vector 0f angles in incrments of 5 from -5 to 25 I have another vector N with 14 elements I am really lost Daniel Sodehttps://jp.mathworks.com/matlabcentral/profile/authors/15314324-daniel-sodetag:jp.mathworks.com,2005:Question/4569312019-04-17T13:02:59Z2019-04-18T12:30:14Zfprintf length of vectorhow do i print the length of a vector?? so i have a vector V = [4,9,-3,12,0,-9,15,17,25,-6,4,10,-2,15] and i got its length by L = length (V) now how do i print the length?Arashdeep Dhillonhttps://jp.mathworks.com/matlabcentral/profile/authors/14892007-arashdeep-dhillontag:jp.mathworks.com,2005:Question/4571572019-04-18T11:37:25Z2019-04-18T12:30:08ZNIST Randomness test executionIs it possible to execute NIST TEST FOR RANDOMNESS in matlab?
If so what and all the changes do we need in order to run the programs?
N M Channabasavayyahttps://jp.mathworks.com/matlabcentral/profile/authors/14634007-n-m-channabasavayyatag:jp.mathworks.com,2005:Question/4571642019-04-18T12:27:04Z2019-04-18T12:27:35ZHow to sum over next delta of rowsHi,
I have a 527040 x 4 table
I need a new table, that gives me for each i = size(array,1) the sum of the next delta of rows
So for example set delta = 4
row 1 should be sum of rows 2 to 5
row 2 should be sum of rows 3 to 6 and so on
me biggest problem now is, i dont know what to do at the end of my input table if the number of remaining rows is smaller then my delta. I think the best idea is to just cut them out....
any ideas?
I use MATLAB R2019a for studentsAntonio Melienihttps://jp.mathworks.com/matlabcentral/profile/authors/14992125-antonio-melienitag:jp.mathworks.com,2005:Question/4571612019-04-18T12:17:02Z2019-04-18T12:26:25ZHow to related PCA output to the original data?Hello,
I'm new to PCA and I would like to learn the outcome of pca function. I have read the document and checked others works but I'm a bit confused on how to related the results (wcoeff, latent, explained) to the original data. For example, I'm using the example from the document as below. I understand the (wcoeff) presents the eigenvector vectors. the (latent) presents the eigenvalues. the (explained) is the percentage of the total variance explained by each principal component. NOW, how are all these information are related to the main data which is the ingredients here? how do I know from looking at the results in (explained) that the 55 % is related to which variables or columns in the ingredients matrix?
load hald
[wcoeff,~,latent,~,exp
lained] = pca(ingredients,'VariableWeights','variance')
wcoeff = 4×4
-2.7998 2.9940 -3.9736 1.4180
-8.7743 -6.4411 4.8927 9.9863
2.5240 -3.8749 -4.0845 1.7196
9.1714 7.5529 3.2710 11.3273
latent = 4×1
2.2357
1.5761
0.1866
0.0016
explained = 4×1
55.8926
39.4017
4.6652
0.0406Yaser Khojahhttps://jp.mathworks.com/matlabcentral/profile/authors/8998848-yaser-khojahtag:jp.mathworks.com,2005:Question/4570322019-04-17T20:33:31Z2019-04-18T12:23:07ZBrain freeze re: grouping and recombinationHave two files of correlated data via a categorical variable -- in the first, the name field has been normalized such that can find the grouping of the multiple (1 to 3 each, variable) accounts associated with each name. I have the cell array of those accounts by unique group in this file.
The same accounts exist (amongst others not of interest here) in a second file in which the name field has NOT been and for arcane reasons CANNOT be normalized (well, not so arcane, just that it is dynamic and generated external to process over which I have any control from a database prior to the normalization having occurred that can't be changed for the immediate future).
I need to find and associate the accounts by the account numbers according to the first list in the second file -- where I ran into brain cramp was a way without just iterating through the list and doing individual lookup but to generate the addressing vector by group to associate the multiple accounts.
Hopefully there's enough of a description to see the issue...I'll try to desensitize the data sufficiently to post a small sample set but there's personal, private info in the real set so didn't want to just post a subset as is...dpbhttps://jp.mathworks.com/matlabcentral/profile/authors/28872-dpbtag:jp.mathworks.com,2005:Question/4571582019-04-18T11:40:14Z2019-04-18T12:21:52ZHow can I change variables within a GUI to make plot using the data from user input?I am making a GUI for displaying the path of a projectile, moving with projectile motion. How this will work is that you select wether you are on the Earth or Moon for gravitational acceleration via uicontrol's popup menu. Both the launch velocity and angle will be selected using the same method.
After getting the figure window and the popup menus for the gravity and velocity conditions to display correctly, I tried to use callback functions to set variables which will be used in formulae later in the script.
So how would you change variables once data has been selected using uicontrol components?
I am pretty new to this and have not really found a working solution so far. If you do provide a solution, could you explain it with as much depth as possible to help my understanding of this?
Below is the function for the GUI:
function ballistic
clc
f = figure('Visible','off','Position',[360,500,600,285]);
contxt=uicontrol('Style','text','String','Conditions:',...
'Position',[462,260,60,15]);
veltxt=uicontrol('Style','text','String','Launch Velocity:',...
'Position',[457,200,100,15]);
mps1=uicontrol('Style','text','String','m/s',...
'Position',[548,180,60,15]);
con=uicontrol('Style','popupmenu',...
'String',{'Earth','Moon'},'Position',[465,240,100,20],...
'Callback',@callback_con);
vel=uicontrol('Style','popupmenu',...
'String',[1:1:100],'Position',[465,180,100,20],...
'Callback',@callback_vel);
function callback_con(source,eventdata)
str=source.String;
val=source.Value;
switch str{val};
case 'Earth'
g=9.81;
case 'Moon'
g=1.62;
end
end
function callback_vel(source,eventdata)
switch source.Value
case source.Value>0
velzero=source.Value;
end
end
f.Units = 'normalized';
contxt.Units = 'normalized';
veltxt.Units = 'normalized';
mpsl.Units = 'normalized';
con.Units = 'normalized';
vel.Units = 'normalized';
f.Name = 'Ballistic Path Visualisation';
movegui(f,'center')
f.Visible = 'on';
endMike Stevenshttps://jp.mathworks.com/matlabcentral/profile/authors/15309589-mike-stevenstag:jp.mathworks.com,2005:Question/4569462019-04-17T14:15:21Z2019-04-18T12:20:34Zhow to create lookup table for torque vs speedhow to create a lookup table for torque and speed
it must be a boost lookup table sesha saihttps://jp.mathworks.com/matlabcentral/profile/authors/13891845-sesha-saitag:jp.mathworks.com,2005:Question/4571442019-04-18T10:28:44Z2019-04-18T12:20:10Zbuilt-in function for rotating a curveis there any built in function to rotate any curve along any random axis(say i want to rotate a bezier curve along [1 1 1] by 30 degrees)?rutvik baxihttps://jp.mathworks.com/matlabcentral/profile/authors/14804470-rutvik-baxitag:jp.mathworks.com,2005:Question/4571622019-04-18T12:17:16Z2019-04-18T12:17:16ZHow to turn a function with a for loop into a recursive functionHello, I have a task to write a recursive function, that solves a system with an upper-triangular coefficient matrix. I mean, to solve the system: Ax=b, when A is an upper-triangular coefficient matrix
I wrote a function using for loop, howover I don't know how to turn it into a recursive function. Here's my code:
function x=uppermatsolve(M,b);
x=zeros(size(b));
[n,m]=size(M);
x(n,:)=b(n,:)/M(n,n);
for k=n-1:-1:1
x(k,:)=(b(k,:)-M(k,k+1:n)*x(k+1:n,:))/M(k,k);
end
Any help is greatly appreciated!
Lee Cohenhttps://jp.mathworks.com/matlabcentral/profile/authors/12573326-lee-cohentag:jp.mathworks.com,2005:Question/4571472019-04-18T10:41:16Z2019-04-18T12:17:05ZCalculate area under a curve and between two horizontal linesHello Matlab users,
I have a (basic I'm afraid) question of maths/Matlab.
I would like to calculate the area 1/ under a curve and 2/ between to y-values. For instance with the following set of data ploted below, i'd like to calculate the green area.
x = [5.54 6.66 7.66 8.69 9.38 9.86 10.40 10.91 11.47 11.88 12.26 12.41 12.43 12.47 12.57 12.65 12.66 12.75 12.76 12.79 12.80 12.86 12.92 12.97 13.02];
y = [2.8 2.6 2.2 2.2 2.4 2.5 2.6 2.4 2.3 2.5 2.6 2.5 2.4 2.2 1.7 1.3 1.4 0.9 0.8 0.8 0.6 0.5 0.3 0.1 0.0];
top = 1.25;
bottom = 0.75;
I guess I should be able to do that using trapz but I'm unsure how to proceed... Could someone help me with this please?
Thanks a lot.Anais Jacqhttps://jp.mathworks.com/matlabcentral/profile/authors/14742720-anais-jacqtag:jp.mathworks.com,2005:Question/4571592019-04-18T11:59:54Z2019-04-18T12:17:01ZI have a maths question here about units in MatlabI have a 50*50 cm grid.I change it to 250*250 grid by multiplying it with 5 in matlab.
Now how to write my units by keeping in mind of 50*50 cm - can it be wrtitten as 50*(5) cm * 50*(5) cm ?
or 5:1 cm ? or how can it be written in meters?
Kaleesh Balahttps://jp.mathworks.com/matlabcentral/profile/authors/12612866-kaleesh-balatag:jp.mathworks.com,2005:Question/4569452019-04-17T14:03:48Z2019-04-18T12:16:45ZSignificance test using t-test and p-valueDear All
I have the following results of three different algorithms over 12-benchmark funtions, I want to make a significance test using t-test and p-value, any body may help me.
Algo-1 Algo-2 Algo-3
F1 1.62E-04 7.52E-10 1.59E-63
F2 1.90E+01 5.52E+00 5.71E+00
F3 9.30E-01 2.03E-01 2.87E-01
F4 2.48E-01 2.20E-01 1.74E-01
F5 5.95E+01 1.57E+00 2.09E+00
F6 6.21E-02 5.15E-02 5.44E-02
F7 3.78E-11 1.31E-11 1.33E-02
F8 8.47E-11 1.52E-12 7.16E-55
F9 8.31E-14 2.59E-14 0.00E+00
F10 -6.87E+00 -4.10E+00 -3.89E+00
F11 -9.55E+02 -9.49E+02 -9.58E+02
F12 2.28E-13 4.94E-14 1.78E-31
sofian kassaymehhttps://jp.mathworks.com/matlabcentral/profile/authors/12169809-sofian-kassaymehtag:jp.mathworks.com,2005:Question/4571492019-04-18T10:42:40Z2019-04-18T12:13:49Zhow two use deep learning to classsify remote image ?how to prepare the train data,test data?
how to input the data?Li Linhttps://jp.mathworks.com/matlabcentral/profile/authors/12793159-li-lintag:jp.mathworks.com,2005:Question/4539722019-04-02T18:04:03Z2019-04-18T12:13:36ZUsing viscircles in App DesignerI am trying to use viscircles in App Designer. Is that possible?
I have a image (imshow) shown on my App, and I would like to draw the the circles on the image..Karen Eich Hammerhttps://jp.mathworks.com/matlabcentral/profile/authors/10797751-karen-eich-hammertag:jp.mathworks.com,2005:Question/4164362018-08-27T21:17:11Z2019-04-18T12:12:55ZHow can I create interactive imdistlines and also create circles in Matlab app designer?I have a question about Matlab app designer visualization. I am currently creating an app to read images that contain fish eggs and measure the radius of the circles using imfindcircles(). This works well but I run into trouble when I want to enable the user to preview the sensitivity and radius they are using to search for the circles. I have tried using imdistline() and viscircles() to do this but it returns an error that says these are not supported in the app designer. I am a bit confused as to what I should do at this point and wondering if there are alternatives to drawing on uiaxes or another way to use those functions I am familiar with using not in the app Designer.Cade Napierhttps://jp.mathworks.com/matlabcentral/profile/authors/12963271-cade-napiertag:jp.mathworks.com,2005:Question/4543392019-04-04T08:05:44Z2019-04-18T12:02:01ZGA violates the linear inequality constraintsHi. I have mixed integer non-linear optimization problem with two optimization variables, each of size K*M*N. For now I have tried the linear inequality constraitns. The result of opt. variable does not meet the constraints.
I have attached the complete code. Please highlight the issues.
Also, can ga solve this problem?
Thanking you in advance.Umber Saleemhttps://jp.mathworks.com/matlabcentral/profile/authors/15192456-umber-saleemtag:jp.mathworks.com,2005:Question/4571522019-04-18T11:14:33Z2019-04-18T12:00:53ZI have two datasets and I want to put them in one structthe photo shows example of how I want to make the struct. basically I have cst1 & cst2 and I want to put them in one struct just like the photo(features & labels)
Taha Alarshttps://jp.mathworks.com/matlabcentral/profile/authors/12295327-taha-alarstag:jp.mathworks.com,2005:Question/4559372019-04-12T05:16:40Z2019-04-18T11:57:58ZHow to Alternating minimize the Frobenius normminimize (A,B) of , where F denotes Frobenius norm
constraints = n
where diamension of A = m x n, and B = p x mManoj Kumarhttps://jp.mathworks.com/matlabcentral/profile/authors/13309685-manoj-kumartag:jp.mathworks.com,2005:Question/4535042019-03-31T05:44:14Z2019-04-18T11:57:30ZUse MATLAB on local ThingSpeak serverWe plan to build a web applicaiton inside coporate LAN using local installed ThingSpeak server. The questions are:
Do we have to buy MATLAB license in order to use MATLAB functions within ThingSpeak server?
What kind of MATLAB functions are supported for local Thingspeak server? Are all MATLAB functions supported?
What kind of MATLAB Toolboxes are ThingSpeak server support? It is better to know it before buying an appropriate toolebox license so we do not waste money.
Thanks.
JamesJames Guanghttps://jp.mathworks.com/matlabcentral/profile/authors/13256278-james-guangtag:jp.mathworks.com,2005:Question/3210662017-01-19T11:00:49Z2019-04-18T11:44:14ZPlotting from a loop in a live script in Matlab 2016bI want to plot and write text fro a loop in a live script. Unfortunately this puts all the text at the top and charts at the bottom. Does anyone know how to fix this?
for j = 1:3
figure
plot(1:10,j*ones(1,10))
drawnow
grid on
title(sprintf('This is plot %d',j))
fprintf('This is the text for plot %d\n',j)
drawnow
end
I have attached the live script for testing.Olaf Bouschehttps://jp.mathworks.com/matlabcentral/profile/authors/1043626-olaf-bouschetag:jp.mathworks.com,2005:Question/4571562019-04-18T11:37:23Z2019-04-18T11:39:51Zsparse matrix problem !A sparse matrix is a large matrix with almost all elements of the same value (typically zero). The normal representation of a sparse matrix takes up lots of memory when the useful information can be captured with much less. A possible way to represent a sparse matrix is with a cell vector whose first element is a 2-element vector representing the size of the sparse matrix. The second element is a scalar specifying the default value of the sparse matrix. Each successive element of the cell vector is a 3-element vector representing one element of the sparse matrix that has a value other than the default. The three elements are the row index, the column index and the actual value. Write a function called sparse2matrix that takes a single input of a cell vector as defined above and returns the output argument called matrix, the matrix in its traditional form. Consider the following run:
cellvec = {[2 3], 0, [1 2 3], [2 2 -3]};
matrix = sparse2matrix(cellvec)
matrix =
0 3 0
0 -3 0
can anyone tell me the code?Abhishek singhhttps://jp.mathworks.com/matlabcentral/profile/authors/14995171-abhishek-singhtag:jp.mathworks.com,2005:Question/4569032019-04-17T10:46:26Z2019-04-18T11:36:59Zhow to count the number of element in observation and make summation? c b a 110
a d a 1551
a b b 502
a b c 179
d b a 124
For the observations given above, I want to count the number of elements in individual observations
and want to divide the value of the 4th column proportionally, according to the number of element in the same row.
For example, for above example, I want to give a=110/3+ 1551*2/3+502/3+179/3+124/3.
Does anyone know how to compute this in matlab?
For your reference, I will attach my .mat file.
Thank you.HOJUNG LEEhttps://jp.mathworks.com/matlabcentral/profile/authors/11634280-hojung-leetag:jp.mathworks.com,2005:Question/4571552019-04-18T11:23:50Z2019-04-18T11:34:50ZDouble integration within finite limitsI want to perform a double integration of the function f(x,y)=y*sin(x)+exp(-x), over the range 0 to pi/6 for x and y goes from 0 to 3. I have gone through a few answers here but they look clumsy and confusing. Can anyone please suggest me what the code for this problem will be like?Shaona Bosehttps://jp.mathworks.com/matlabcentral/profile/authors/14710511-shaona-bosetag:jp.mathworks.com,2005:Question/4571372019-04-18T09:49:43Z2019-04-18T11:34:28ZAudio - Wah wah effect - 'Integer Operands Are Required for Colon Operator When Used as Index'Hi, I'm making a 'wah wah' effect in matlab.
I'm getting the error 'Integer Operands Are Required for Colon Operator When Used as Index' in my while loop
while(length(cutoff_freq) < length(input_sound))
cutoff_freq = [cutoff_freq(max_f:-centre_f:min_f)];
cutoff_freq = [cutoff_freq(min_f:centre_f:max_f)];
end
How can I fix that?
The full code can be seen below:
% Read the audio file
[input_sound, Fs] = audioread('AcGtr.wav');
% Variables
dampFactor = 0.05; %The lower it is, the smaller pass band
wahFreq = 1000; % How many Hz per second are cycles through
min_f = 250; % Minimum cut off frequency
max_f = 5000; % Maximum cut off frequency
centre_f = wahFreq/Fs; % The change in centre frequency per samlple (Hz)
% Triangle wave based on the centre frequency values
cutoff_freq = min_f:centre_f:max_f;
while(length(cutoff_freq) < length(input_sound))
cutoff_freq = [cutoff_freq(max_f:-centre_f:min_f)];
cutoff_freq = [cutoff_freq(min_f:centre_f:max_f)];
end
% Make it fit the audio input size
cutoff_freq = cutoff_freq(1:length(input_sound));
% Filter coefficient
coF = 2*sin((pi*cutoff_freq(1)/Fs));
Q = 2*dampFactor; %Q = quality factor, band width
% Arrays of zeros for the filters, size fits the input sound
highpass = zeros(size(input_sound));
lowpass = zeros(size(input_sound));
bandpass = zeros(size(input_sound));
% Avoid neagtive signals (multiplying by zero errors) the first is con calculated
highpass(1) = input_sound(1);
bandpass(1) = coF*highpass(1);
lowpass(1) = coF*bandpass(1);
% Differenetial equations
for n = 2:length(input_sound)
highpass(n) = input_sound(n) - lowpass(n-1) - Q*bandpass(n-1);
bandpass(n) = coF*highpass(n) + bandpass(n-1);
lowpass(n) = coF*bandpass(n) + lowpass(n-1);
coF = 2*sin((pi*cutoff_freq(n))/Fs);
end
% Normalise audio and play it
norm = bandpass./max(max(abs(bandpass)));
audiowrite('AcGtr.wav', norm, Fs);
sound(norm,Fs)Ditte Brodersenhttps://jp.mathworks.com/matlabcentral/profile/authors/12068669-ditte-brodersentag:jp.mathworks.com,2005:Question/4571502019-04-18T10:49:45Z2019-04-18T11:31:20ZCould anyone help me to solve the issue.I am having 5 users whose initial_position are generated by the code itself and gives the value as follows:
initial_position=1.7620e+06
initial_position=1.9911e+06
initial_position=1.8969e+06
initial_position=2.5384e+06
initial_position=2.5042e+06
All the 5 values are generated inside for loop in my code by running the loop 5 times.
Once the initial position is generated i need to find one common_position which is the maximum initial_position .
So i used the command ,common_position=max(initial_position) outside the for loop in order to find it
I got the result as common_position=2.5384e+06.
In the next step i need to use the expression of (common_position-initial_position)
so far in my code common_position is one which is calculated outside for loop, but initial_position is five which gets calculated inside for loop
Could anyone help me how can i use the expression of (common_position-initial_position) to generate 5 different values with respect to the difference of two positions.
jaah navihttps://jp.mathworks.com/matlabcentral/profile/authors/11695462-jaah-navitag:jp.mathworks.com,2005:Question/4571532019-04-18T11:19:02Z2019-04-18T11:31:16Zinterpolation of 3d dataI want to interpolate my data with respect to z values means the blank spaces present got filled and z values are interpolated by krigging technique and get result in x y z format but the codes present on the forum interpolates data in the form of bigger matrix and and also do not provide satisfactory results. some code also fails and returns error as data size is too large.
Can anybody pls suggest a code for this. Pls help.....ashwani kumarhttps://jp.mathworks.com/matlabcentral/profile/authors/15243249-ashwani-kumartag:jp.mathworks.com,2005:Question/65372011-04-30T18:00:38Z2019-04-18T11:23:20ZHow do I change the marker size for a plot?Im trying to set the marker size on a plot but having no luck, heres my code
this works fine
plot(
x , x^2,'-k*',...
x , x^3,'-ko',...
x , x^4,'-k' )
but when i try and set marker size it does not
plot(
x , x^2,'-k*',...
x , x^3,'-ko','MarkerSize',12,...
x , x^4,'-k' )
what do I need to do?john birthttps://jp.mathworks.com/matlabcentral/profile/authors/2748436-john-birttag:jp.mathworks.com,2005:Question/4570722019-04-18T03:02:35Z2019-04-18T11:22:20ZPlotting The bodee plots extracted from LTSPICE simulatorHello,
After I simulated a circuit using a LTSPICE simulator and got the bode plots, I wanted to plot these plots using Matlab, so I exported the bode plots to a TXT file (attached to this post) in order to be able to plot them after that using matlab.
after I put the .txt file in the matlab directory, I used the command "dlmread('Data.txt);", nevertheless, Matlab could not read the text file.
Is there a way so that I can read the file and plot it using Matlab?Nour Eldeenhttps://jp.mathworks.com/matlabcentral/profile/authors/8283591-nour-eldeentag:jp.mathworks.com,2005:Question/4568762019-04-17T08:19:05Z2019-04-18T11:21:59ZHow to draw represent connected components bounding boxes with different color??I'm working on handwritten documents,so I want to show bounding boxes of different line with different color.
I've a matrix which contains the connected components values and I want to color bounding boxes using this color.IP student ;(https://jp.mathworks.com/matlabcentral/profile/authors/14593505-ip-studenttag:jp.mathworks.com,2005:Question/4571542019-04-18T11:20:31Z2019-04-18T11:20:31ZEvent not triggering when condition met with ODE45I am trying to make my ode45 stop solving once a certain condition is met using an event function. I can see that my condition is met many times through the process, yet the integration continues (I did try seeing if it should be the negation of my stated condition, but it's still the same so not sure there). The condition is that g should be equal to some value I've called condition, where it stops once this occurs. Are there any errors in this code that I'm not seeing?
%% Solver
trebuchetparameters % load parameters
Opt = odeset('Events',@myEvent);
[t, y] = ode45(@trebuchet,[0 tspan], y0, Opt);
theta = y(:, 1); % theta
theta_dot = y(:,2); % theta'
phi = y(:, 3); % phi
phi_dot = y(:, 4); % phi'
function [yprime] = trebuchet(t, y)
trebuchetparameters % load parameters
trebuchetvariableshorthand % bunch of variables
yprime=zeros(4,1);
yprime(1) = y(2);
yprime(3) = y(4);
yprime(2) = iota_1;
yprime(4) = iota_1.*iota_2+iota_3;
end
function [value, isterminal, direction] = myEvent(t, y)
trebuchetparameters, trebuchetvariableshorthand, trebuchetevent % parameters, variables, condition
value = abs(g - condition) < tolerance
isterminal = 1;
direction = 0;
end
aaqqmate123aqnhttps://jp.mathworks.com/matlabcentral/profile/authors/12743925-aaqqmate123aqntag:jp.mathworks.com,2005:Question/4571102019-04-18T07:27:00Z2019-04-18T11:20:12ZRunning a matlab file multiple times on the same computerCan I run the same version of my matlab code, simultaneously, on the same computer (with different input data and input/output folders)?
My computer has 4 cores and I want to take advantage of this. Kostas Housiadashttps://jp.mathworks.com/matlabcentral/profile/authors/15323082-kostas-housiadas