https://it.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-04-21T00:18:37Ztag:it.mathworks.com,2005:Question/3930262018-04-06T07:55:30Z2019-04-21T00:18:37ZHow to Code for "Artificial Flora (AF) Optimization Algorithm?"The *Artificial Flora (AF) Optimization Algorithm* has been proposed recently.
The authors wrote that they use MATLAB, but they did not publish the code.
Knowing that if there is an open access method that can code this method with MATLAB, it will make a big contribution to science.
It is very important to explicitly publish Matlab codes for the development of the method and the experimental results.
Algorithm of the method proposed by the authors:
<<http://www.mdpi.com/applsci/applsci-08-00329/article_deploy/html/images/applsci-08-00329-g002.png>>
You can access the paper and method algorithm in the following address.
<http://www.mdpi.com/2076-3417/8/3/329>
If there is anything that can help in the coding, I'm very happy. I am ready to make the contribution for coding the method with MATLAB.
Thank you very much. Yasin KAYAhttps://it.mathworks.com/matlabcentral/profile/authors/10058776-yasin-kayatag:it.mathworks.com,2005:Question/4575972019-04-20T23:10:47Z2019-04-21T00:12:08ZHow to use polyfit to get the difference out of two functions?Hi
I have two datasets (X,Y). For every value of Y that corresponds to a value of X.
I am thinking of applying a polyfit command to get the best curve fitting for the data, and as a result I will come up with a function (slope+intercept).
How do I find the difference between those two functions? What command do I apply to subtract Function A from Function B?
Stelios Fanourakishttps://it.mathworks.com/matlabcentral/profile/authors/10865530-stelios-fanourakistag:it.mathworks.com,2005:Question/4575882019-04-20T21:48:48Z2019-04-21T00:04:03ZHow to update nodes with the calculated distance weight ? without using Dijkstra functionI need to code for dijkstra algorithm (without using matlab built in function), can anyone please tell me how to code it ? further how to update weights of the visited nodes ?
Fariha Komalhttps://it.mathworks.com/matlabcentral/profile/authors/14913336-fariha-komaltag:it.mathworks.com,2005:Question/4575892019-04-20T21:56:28Z2019-04-21T00:00:51Zellipsoid with surf command?obviously there are some complex numbers because of root in this code, but how can we plot ellipsoid using functions in the library?
[x,y] = meshgrid(1:0.5:10,1:20);
z = sqrt((3-x.^2-y.^2)/4);
surf(x,y,z)Kuatra Patilhttps://it.mathworks.com/matlabcentral/profile/authors/15291254-kuatra-patiltag:it.mathworks.com,2005:Question/4575992019-04-20T23:47:43Z2019-04-21T00:00:31ZRadius of Curvature ArrayThe code generates radius of curvatures for three points(coordinates x1,y1 x2,y2 and x3,y3. However, i have a set of coordinates (77) in all, and I am trying to rewrite the code to loop through the coordinates and generate a radius of curvature for every three points within the set of 77, and store the result in another variable say R. I have not been able to do this and I need urgent help: See the radius of curvature code below that generates when radius of curvature for 3 points.
function lambda=mycurvature(xinput, yinput)
global xstar ystar;
xstar=xinput;ystar=yinput;
alpha=atan2(ystar(2)-ystar(1),xstar(2)-xstar(1))-atan2(ystar(3)-ystar(2),xstar(3)-xstar(2));
if abs(alpha)<0.002; %set the curvature to 0 if the points are aligned
R=inf; lambda=0;
%plot(xstar,ystar,'-r',xstar,ystar,'*b','linewidth',2,'markersize',10);
else
initialguess = [1; 1; 1]; % Make a starting guess at the solution
options=optimset('Display','none'); % Option to display output
res = fsolve(@userfun,initialguess,options); % Call optimizer
x0=res(1);y0=res(2);R=res(3); %x-coord of center; y-coord of center; radius of curvature
lambda=1/R; %curvature
%t=0:0.01:2*pi;xx=x0+R*cos(t);yy=y0+R*sin(t);
%plot(xx,yy,'-r',xstar,ystar,'*b','linewidth',2,'markersize',10);
end
%str=sprintf('radius=%6.3f, curvature=%6.3f',R,lambda);
%title(str, 'fontsize', 14);xlabel('x'),ylabel('y');
%axis equal;
function F = userfun(vars)
global xstar ystar;
F = [...
(xstar(1)-vars(1))^2+(ystar(1)-vars(2))^2-(vars(3))^2; ...
(xstar(2)-vars(1))^2+(ystar(2)-vars(2))^2-(vars(3))^2; ...
(xstar(3)-vars(1))^2+(ystar(3)-vars(2))^2-(vars(3))^2; ...
];
xinput are the array of x coordinates for the three points, yinput are the array of y coordinates for the 3 points.
What i am doing that is not working is
x = [array of my x-coordinates of my 77 points]; y =[array of my y-coordinates of my 77 points]
for i = 1:3:length(x)-1
xinput = x(i), x(i+1), x(i+2)
yinput = y(i), y(i+1), y(i+2)
and then removed the function at the first line of code for the radius of curvature code above. This did not work. What am I doing wrong? Please help.Jide Williamshttps://it.mathworks.com/matlabcentral/profile/authors/13528121-jide-williamstag:it.mathworks.com,2005:Question/4575912019-04-20T22:06:54Z2019-04-20T23:59:42ZHow can i coding binary array using RNA codingHello every one
pls if any one know .
How can i coding binary array using RNA codingRNA coding?
ammar mohammedhttps://it.mathworks.com/matlabcentral/profile/authors/14858931-ammar-mohammedtag:it.mathworks.com,2005:Question/4575922019-04-20T22:15:40Z2019-04-20T23:58:52ZHow canI i generate chaotic map 3 Dimension and convert it into hexadecimal ?Hello every one
I want code of How can I generate chaotic map 3 Dimension and convert it into hexadecimal ?
pls If anyone can help me
Aliammar mohammedhttps://it.mathworks.com/matlabcentral/profile/authors/14858931-ammar-mohammedtag:it.mathworks.com,2005:Question/4575942019-04-20T22:46:27Z2019-04-20T23:57:16ZHow can I prevent MATLAB from changing certain initial conditions using ode15s?I am trying to solve a DAE system using ode15s.
Due to the structure of ode15s I have to input initial conditions for all variables, however using degrees of freedom analysis on the problem only the differential equations need initial conditions. Due to that, I obtained all of the initial conditions in another MATLAB script and input them in ode15s. As MATLAB converges, however, it's changing the initial conditions of the 2 differential equations (which are the only ones that need to remain constant, in order to solve the required physical problem).
Is there a way to ensure that certain initial conditions remain unchanged?Georgios Pasiashttps://it.mathworks.com/matlabcentral/profile/authors/11127140-georgios-pasiastag:it.mathworks.com,2005:Question/4575962019-04-20T22:51:51Z2019-04-20T23:56:06ZWrite a MATLAB® Write a MATLAB® script to graph the variable (𝒚) vs. the variable (𝒙). . [2 Pts] 𝒚 = 𝟎. 𝟒 √𝟏. 𝟖 𝒙 for 𝟎 ≤ 𝒙 ≤ 𝟑𝟓Pamela Aquinohttps://it.mathworks.com/matlabcentral/profile/authors/15290678-pamela-aquinotag:it.mathworks.com,2005:Question/4575982019-04-20T23:38:52Z2019-04-20T23:55:09ZWon't Plot in 3D%-----------------------------------------------------------------
%.... Name:Ariana Garcia
%.... Date:April 21,2017
%.... Project:CP4
%.... Recitation Section:Mon
%-----------------------------------------------------------------
%-----------------------------------------------------------------
%....
%.... Truss Analysis
%....
%-----------------------------------------------------------------
%***** READ THIS *****
% You must modify this code so that it works for any truss that the user
% wishes to analyze, whether 2-D or 3-D.
% Therefore, after your code is modified, all trusses should be assumed as
% 3-D Space Trusses.
% For 2-D planar trusses, the z-coordinate of each joint should be zero
% and the e3 magnitude of all external forces and reactions should be zero.
clear; clc;
% Print Banner to command window
fprintf('%s\n','*-----------------------------------------------*')
fprintf('%s\n','| CEE210 Statics, Computing Project 4 |')
fprintf('%s\n','| Original by Amie Baisley, 11.01.2013 |')
fprintf('%s\n','| Modified by Chris A. Lawrence, 04.02.2016 |')
fprintf('%s\n','*-----------------------------------------------*')
fprintf('\n\n\n')
%% ***********************************************************************
% Create a separate m file that contains several different truss input
% sections, any one of which can be copied and pasted into the truss
% analysis program, without having to modify the rest of the code.
% The file should be named CEE210_NNN_Truss_Inputs.m where NNN is your
% initials.
% The input file should contain every truss that was used to test your
% truss analysis code and must be submitted with your project.
% ************************************************************************
%% **********************************************************************
% 3D Space Trust from CP3
% Units used:
LUnit = 'ft'; % Length = ft or m
FUnit = 'lb'; % Force = lb or kip or N or kN
%.. Input problem data
nNodes = 7; % Number of nodes (pin joints) in the truss
nMembers = 15; % Number of members
nReactions = 3; % Number of force vector reactions
nLoads = 1; % Number of externally applied loads
nDim = 3; % Dimensions 2=2D, 3=3D
% *** Once your code is modified and tested, nDim must always equal 3 and
% the variable nDim cannot be used in your code.
nDOF = nDim * nNodes; % Number of degrees of freedom
tol = 1.e-8; % Remainder tolerance on norm of residual force
%.... Input node coordinates
Node(1,:) = [2,-3,0];
Node(2,:) = [2,3,0];
Node(3,:) = [-4,3,0];
Node(4,:) = [1,-1.5,6];
Node(5,:) = [1,1.5,6];
Node(6,:) = [-2,1.5,6];
Node(7,:) =[0,0,12];
%.... Finish inputting nodes
%.... Input member connections
Member(1,:) = [1,2];
Member(2,:) = [2,3];
Member(3,:) = [3,4];
Member(4,:) = [3,5];
Member(5,:) = [3,6];
Member(6,:) = [1,3];
Member(7,:) = [2,5];
Member(8,:) = [2,4];
Member(9,:) = [1,4];
Member(10,:) = [4,7];
Member(11,:) = [5,7];
Member(12,:) = [6,7];
Member(13,:) = [5,6];
Member(14,:) = [4,5];
Member(15,:) = [5,7];
%.... Finish inputting member connections
% Input support reactions
%.. First input is the node number
%.. Second input is resistance in the e1 direction
%.. Third input is resistance in the e2 direction
%.. Fourth input is resistance in the e3 direction (zero for 2-D trusses)
%*** 1 for resistance in that direction, 0 for no resistance ***
Reaction(1,:) = [1, 1,1,0]; % Pin at Node 1
Reaction(2,:) = [2, 0,1,0]; % Roller at Node 5
Reaction(3,:) = [3, 1,1,1];
% Input externallly applied loads
%.. First input is the node number, remaining inputs are the magnitude of
%.. the force in the e1, e2 and e3 directions, respectively.
Load(1,:) = [5, 0, 200, -500]; % 1000 lb load at Node 2
% End of Input Section for CP3 Space Trust.......
%*****************************************************************************************
%% Compute the unit vector (direction) for every member
PosVec = zeros(nMembers, 3); %Initialize Position Vector matrix
UnVec = zeros(nMembers, 3); %Initialize Unit Vector matrix
OppUnVec = zeros(nMembers, 3); %Initialize opposite direction matrix
for i = 1 : nMembers
SN = Member(i,1);
EN = Member(i,2);
% ***** This section is where your CP3 code should go. *****
PosVec(i,:) = Node(EN,:)- Node(SN,:); % postion vector
length=norm(PosVec(i,:));
UnVec(i,:)=PosVec(i,:)./norm(PosVec(i,:));
OppUnVec(i,:) = -PosVec(i,:)./norm(PosVec(i,:));
end
%% The coefficient matrix, C, contains the unit vectors (direction vectors)
% for each member force associated with each node. The unit vectors are
% then separated into e1, e2, e3 components and placed in separate rows.
% Therefore, each node has 2 rows (for 2-D) or 3 rows (for 3-D) associated
% with it; one for each of the e1, e2, e3 components.
% This corresponds with the Degrees of Freedom, nDOF, which is 2*nNodes
% for 2-D or 3*nNodes for 3-D.
% So the coefficient matrix has 2 or 3 rows for each node and one column
% for each member force.
C = zeros(3*nNodes, nMembers); %Initialize coefficient matrix
% Loop through all nodes, create the vector force equation for that node
% and store it in the proper row of the coefficient matrix, C.
for i = 1 : nNodes
for j = 1 : nMembers
SN = Member(j,1);
EN = Member(j,2);
if (SN == i) % If member j starts at node i
C(3*i-1, j) = UnVec(j,1);
C(3*i, j) = UnVec(j,2);
C(3*i, j) = UnVec(j,3);
elseif (EN == i) % If member j ends at node i
C(3*i-1, j) = OppUnVec(j,1);
C(3*i, j) = OppUnVec(j,2);
C(3*i, j) = OppUnVec(j,3);
end % if SN
end % for nMembers
end % for nNodes
%% The External Force matrix, F, contains the magnitude of all externally
% applied loads, (input as e1, e2, e3 components), stored in the
% proper rows to corespond with the node it is applied at.
% Therefore, the F matrix has 2 or 3 rows for each node and one column.
F = zeros(3*nNodes, 1); %Initialize External Force matrix
% Loop through all externally applied loads and place each component of the
% load (e1, e2, e3) in the proper rows in the external load matrix, F.
for i = 1 : nLoads
j = Load(i,1); % Which node, j is the load i on
F(3*j-1) = Load(i,2);
F(3*j) = Load(i,3);
F(3*j) = Load(i,4);
end % for i,nLoads
%% The Restraint matrix, Crest, contains the unit vectors (directions)
% for each member force associated with those nodes that are restrained by
% external supports.
% The Crest matrix has one row for each reaction component and one column
% for each member.
%.... Loop through all nodes and determine if there is a reaction at that
%.... node and seperate the reaction node equations from the force load
%.... equations.
nReaction = 1; %Used to count the number of reaction equations
%.... The nReactionEquation vector determines if a row should be put in the
%.... Crest matrix or the Cfree matrix
nReactionEquation = zeros(1, 3*nNodes);
for (j = 1 : nReactions)
for (i = 1 : nNodes)
if (Reaction(j,1) == i)
if (Reaction(j,2) == 1)
Crest(nReaction,:) = C(3*i-1,:);
nReactionEquation(3*i-1) = 1;
% If nReactionEquation is 1 it should be in the Crest
% matrix and not the Cfree matrix.
nReaction = nReaction+1;
end
if (Reaction(j,3) == 1)
Crest(nReaction,:) = C(3*i,:);
nReactionEquation(3*i) = 1;
% If nReactionEquation is 1 it should be in the Crest
% matrix and not the Cfree matrix.
nReaction = nReaction+1;
end
end
end
end
nForce = 1; %Used to count the number of Cfree equations
for (i = 1 : 3*nNodes)
if (nReactionEquation(i) == 1)
else
Cfree(nForce,:) = C(i,:);
Ffree(nForce) = F(i);
nForce = nForce + 1;
end
end
%% Solve first for the member forces and then solve for the support
% reactions.
% All of the values in the Cfree and Ffree matrices are known so you can
% now solve for the T matrix, which is the tension force in each member.
T = -(Cfree)\(Ffree)' ; % finish this equation
% Since all values in the Crest and T matrices are now known, you can solve
% for the support reactions.
Reactions = -Crest*T ; % finish this equation
% Calculate the residual to find the amount of error and ensure that
% equilibrium was satisfied.
Residual1 = (Cfree * T + Ffree');
Residual2 = (Crest * T + Reactions);
Res = norm(Residual1) + norm(Residual2);
% Create the support reaction matrix.
nReaction = 1;
for (i = 1 : nNodes)
if (nReactionEquation(3*i-1) == 1)
SupportReaction(i,1) = i;
SupportReaction(i,3) = Reactions(nReaction);
nReaction = nReaction+1;
end
if (nReactionEquation(3*i-2) == 1)
SupportReaction(i,1) = i;
SupportReaction(i,2) = Reactions(nReaction);
nReaction = nReaction+1;
end
if (nReactionEquation(3*i) == 1)
SupportReaction(i,1) = i;
SupportReaction(i,4) = Reactions(nReaction);
nReaction = nReaction+1;
end
end
%% Create output for command window
fprintf('%s\n' , '----------------------------------------')
fprintf('%s\n' , '------------- Truss --------------')
fprintf('%s\n' , '----------------------------------------')
fprintf('%s',' Node Coordinates (', LUnit, ')')
fprintf ('\n')
for i = 1 : nNodes
fprintf('%s%4i%8.3f%8.3f%8.3f\n',' Node: ', i, Node(i,:)')
end % for i, nNodes
fprintf ('\n')
fprintf('%s',' Member Forces (', FUnit, ')')
fprintf ('\n')
for i = 1 : nMembers
fprintf('%s%4i%12.3f\n',' Member Force: ',i, T(i))
end % for i, nMembers
fprintf ('\n')
for i = 1 : nReactions
for j = 1 : nNodes
if (Reaction(i,1) == j)
fprintf('%s%s%s%4i%12.3f%12.3f%12.3f\n',...
' Support Reaction (',FUnit,') at Node ',...
SupportReaction(j,:))
fprintf ('\n')
end % if Reaction
end % for j, nNodes
end % for i, nReactions
fprintf('\n%s%8.3f\n',' Residual Error: ', Res)
fprintf('\n\n\n')
%% Create the plot............................................
% Once your code is modified the plot will be 3-D and so you may need the
% "Rotate 3D" command to view the truss figure properly.
%.. Plot members with color indicating tension or compression
Marker = ceil(25 / sqrt(nNodes));
fig1 = figure(1); clf; grid on; axis equal;
hold on;
xlabel(cat(2, 'X (',LUnit,')' ));
ylabel(cat(2, 'Y (',LUnit,')' ));
zlabel(cat(2, 'Y (',LUnit,')' ));
title('Truss Analysis');
small = max(T)*tol;
for m = 1 : nMembers
if (T(m) < -small)
MColor = 'b'; % Color compression members blue
elseif (T(m) > small)
MColor = 'r'; % Color tension members red
else
MColor = 'k'; % Color "zero force members" black
end % if T
SN = Member(m,1);
EN = Member(m,2);
X = [Node(SN,1); Node(EN,1)];
Y = [Node(SN,2); Node(EN,2)];
Z = [Node(SN,3); Node(EN,3)];
if nDim== 3
p = plot3(X,Y,Z);
end
if nDim== 2
p = plot(X,Y);
end
set(p, 'Color', MColor, 'LineWidth', 6/nDim);
end % for m, nMembers
%.. Plot external reaction forces
Rlength = 0.1 * max(max(Node)); % establish size of line
e = [ 1, 0, 0 ; 0, 1, 0 ; 0, 0, 1];
for i = 1 : nReactions
for j = 1 : nNodes
if (Reaction(i,1) == j)
for k = 1 : 2
if(Reaction(i, k+1) == 1)
xR(1,:) = Node(j,:);
xR(2,:) = Node(j,:) - Rlength * e(k, 1:nDim);
xR(3,:) = Node(j,:) - Rlength * e(k, 1:nDim);
if nDim== 2
p = plot(xR(:,1),xR(:,2));
end
if nDim== 3
p = plot3(xR(:,1),xR(:,2),xR(3,:));
end
set(p,'Color','g','LineWidth',8/nDim);
end % if Reaction == 1
end % for k
end % if Reaction == j
end % for j, nNodes
end % for i, nReactions
%.. Plot loads
Llength = 0.1 * max(max(Node)); % establish size of line
Fmax = max(max(abs(Load))); % establish maximum force level
e = [ 1, 0, 0 ; 0, 1, 0 ; 0, 0, 1];
for i = 1 : nLoads
for j = 1 : nNodes
if (Load(i,1) == j)
for k = 1 : 2
F = Load(i, k+1) / Fmax;
xL(1,:) = Node(j,:);
xL(2,:) = Node(j,:) + Llength * F * e(k, 1:nDim);
xL(3,:) = Node(j,:) + Llength * F * e(k, 1:nDim);
if nDim== 2
p = plot(xL(:,1), xL(:,2));
end
if nDim== 3
p = plot3(xL(:,1), xL(:,2),xL(3,:));
end
set(p,'Color','c','LineWidth',8/nDim);
end % for k
end % if Load == j
end % for j, nNodes
end % for i, nLoads
%.. Plot nodes
if nDim==2
plot(Node(:,1), Node(:,2), 'o', 'LineWidth', 2,...
'MarkerFaceColor','w',...
'MarkerEdgeColor','k',...
'MarkerSize',Marker);
view(2);
end
if nDim == 3
plot3(Node(:,1), Node(:,2),Node(:,3), 'o', 'LineWidth', 2,...
'MarkerFaceColor','w',...
'MarkerEdgeColor','k',...
'MarkerSize',Marker);
view(2);
end
% End of Program
I dont know what to do it wont plot in 3D pls help!
Ariana Garciahttps://it.mathworks.com/matlabcentral/profile/authors/10775461-ariana-garciatag:it.mathworks.com,2005:Question/4571872019-04-18T14:27:09Z2019-04-20T23:54:34ZHow to wirte algorithm for meshing line element?Hi,
As you see in the figure, there is a truss structure composed of 2 elements and 3 nodes. In my code, ın order to calculate the stifness and mass matrices, X,Y and Z coordinate table(Table1) and elements table(Table 2) which is made manually are needed. The code runs with these initial information. Now, i want to divide these two elements into more elements whose number depends on the user.
My question is about the algoritm that will create Table1 and Table 2 automatically. What do you think about it? Is ıt possbible? If yes, would you write the steps for algorithm. I just need ideas.
hamit Kenanhttps://it.mathworks.com/matlabcentral/profile/authors/6463402-hamit-kenantag:it.mathworks.com,2005:Question/4575742019-04-20T20:13:56Z2019-04-20T23:46:52ZHow to delete a column from a TimeSeries?Hello,
I would like to know how to delete a column from a TimeSeries.
I need to plot two curves in the same figure but different y-axis. First: time vs temperature; second: time vs level.
I got the temperature from a TimeSeries matrix called MyTimeSeries, whereas the level is in a datetime array. Unfortunatelly, when I try the code below, an error* appears in the add axis function.
plot(MyTimeSeries.Time, MyTimeSeries.Data(:,1)); hold on
addaxis(Time,Level);
So i use the follow code. However, it also plots data (:,2), (:,3), etc, and I need only Data(:,1). That's why I need to delete the other columns.
plot(MyTimeSeries); hold on
addaxis(Time,Level);
Well, I had tried to convert MyTimeSeries.Time and MyTimeSeries.Data to datetime values, but when I do it, the matrix is very strange, with strange numbers instead of time.
I also tried to convert Time and Level to a TimeSeries format, but when I do it, another error** appears, since some values in "Level" are N/A (because this is the way my controller works, it applies N/A for some conditions).
MyTimeSeries.Time format: '29-Mar-2019 09:40:15'
================================================================================
*Error:
Error using aa_splot (line 24)
Data inputs must match the axis configuration. A numeric axis must have numeric
data inputs or data inputs which can be converted to double.
Error in addaxis (line 135)
hplts = aa_splot(varargin{:});
**Other error:
Error using timeseries.tsChkTime (line 572)
Time vector must contain only finite values.
Error in timeseries/init (line 286)
time = timeseries.tsChkTime(time);
Error in timeseries (line 343)
this = init(this,varargin{:});Marlon Saveri Silvahttps://it.mathworks.com/matlabcentral/profile/authors/6314509-marlon-saveri-silvatag:it.mathworks.com,2005:Question/4568912019-04-17T09:48:15Z2019-04-20T23:32:53Zreference to non-existent field solidityhi I have error message in matlab 2017
reference to non-existent field 'solidity'
Error in Tumor(line denisty={stats.solidity};
how can I add reference
what did i miss ?Mohamed Nasrhttps://it.mathworks.com/matlabcentral/profile/authors/15316660-mohamed-nasrtag:it.mathworks.com,2005:Question/4575812019-04-20T21:03:20Z2019-04-20T23:30:15ZCalling option from menu functionThe code has main menu based on ATM macine. 1-Get cash. 2-Get Balance. 3-Quit % if user choose option 1
Mainmenu= menu('Main Menu','1-Get Cash','2-Get Balance','3-Quit');
if Mainmenu ==1
In Get Cash, Another menu that the user have to choose how much to withdraw
GetCashM= menu('Withdrawal amount','20$','40$','100$','200$');
, and after that, another menu to prompt the user to select 1- checking, 2- savings,
Acct= menu('From which account','checking','Saving');
and disp how many 20 bills were dispansed that is after verifying if there are enough funds in the selected account. And when option 1 or 2 are processed, the main menu will show again. I got that done. But, If option 3- quit selected, display New checking Balance and New Saving Balance. But how can I subtract the withdraw amount from checking savings account since menu option are string I think. Even if I called it it would be 1 or 2 or 3 or 4 respectivly to withdraw amount menu.
(ex)
Sbal = 100;
if the user withdrew 20$ from Sbal . "in option 1 from whidraw amount "
"second iteration."
if MainMenu ==. 3 % if the user choose option quit after proseccing whidraw amount
NewSavBal = GetCashMenu - SBal;
but that did not do it since values inside menu were string.
Keep in mind that
If the user closes the menu rather than making a selection, warning message should bedisplayed and the user given 2 more chances to make a selection from that menu. If they still close the menu on the 3rd attempt, an error message should be displayed that says the program has been terminated.mat geekhttps://it.mathworks.com/matlabcentral/profile/authors/9600941-mat-geektag:it.mathworks.com,2005:Question/4575732019-04-20T20:05:51Z2019-04-20T23:24:35ZHow can i shift plot?I have a code i need to shift to right my plot by 1,2,3 and 5, respectively on x axis
p=[1/6 1/6 1/6 1/6 1/6 1/6];
q= conv(p,p)
r=conv(q,p)
rr=conv(r,p)
rrr=conv(rr,p)
rrrr=conv(rrr,p)
hold on
subplot(2,2,1),plot(p*100),xlabel('1 dice vs P(x)'),xlim([1,6]),legend('1 dice','P(x)')
hold on
subplot(2,2,2),plot(q*100),xlabel('2 dices vs Q(x)'),xlim([1,13]),legend('2 dices','Q(x)')
hold on
subplot(2,2,3),plot(r*100),xlabel('3 dices vs R(x)'),xlim([1,19]),legend('3 dices','R(x)')
hold on
subplot(2,2,4),plot(rrrr*100),xlabel('6 dices vs S(x)'),xlim([1,37]),legend('6 dices','S(x)')Ege Tunçhttps://it.mathworks.com/matlabcentral/profile/authors/6193601-ege-tunctag:it.mathworks.com,2005:Question/4569652019-04-17T15:37:15Z2019-04-20T23:08:24ZSimple moving average code for forecasting stock pricesI need code for predicting stock prices in future using simple moving average calculationMegawaty Lestarihttps://it.mathworks.com/matlabcentral/profile/authors/14895494-megawaty-lestaritag:it.mathworks.com,2005:Question/4563022019-04-14T17:57:22Z2019-04-20T22:15:36ZSystem of 2 differential equationsI'm trying to express the following two differential equations in matlab in a form that will allow me to input them into a solver such as ode45. How would I input the following equations into matlab:
dC/dt = (-exp((-10/(T+273)))*C
dT/dt = 1000*(exp((-10)/(T+273))*C-10*(T-20)
where C and T are concentration and temperature (dependent variables) and t is time (independent variable).
Filip Jackowskihttps://it.mathworks.com/matlabcentral/profile/authors/9548942-filip-jackowskitag:it.mathworks.com,2005:Question/4575412019-04-20T14:56:34Z2019-04-20T22:01:01Zregexrep for the neophyteHow to write expression to find and convert financial strings written with comma separator to be able to parse numerically?
Example stirng is something like:
recipients={'John Doe $200, Freddy Flint $132.40 SP19; Mary Lamb $1,423.00-SP19, Joe Blow $1,200'};
which is a list of student scholarship awards entered, unfortunately, free-style in a remarks field in an Excel spreadsheet. I need to parse by student and extract each.
I managed to find/return the location/token of the amounts containing the punctuation, but I'm illiterate with regexp and haven't figured out how to locate the comma then within that substring to remove it.
K>> regexp(recipients,'([$]\d+[,]\d+)','match')
ans =
1×1 cell array
{1×2 cell}
K>> ans{:}
ans =
1×2 cell array
{'$1,423'} {'$1,200'}
K>>
As can be seen, the original text also has "issues" in that the separator between students isn't consistent--it may be a comma or semicolon, not sure what else I'll find as I progress.
For context, this is the next step past the previous Q? of piecing back together disparate databases/spreadsheets...now that I can compare the award to the billing by account, I can find coding or other errors--but need to be able compare the details.
dpbhttps://it.mathworks.com/matlabcentral/profile/authors/28872-dpbtag:it.mathworks.com,2005:Question/4575902019-04-20T21:57:59Z2019-04-20T21:57:59ZDifferences in Performance Between Simulink and Matlab FIRsI am building a BPSK recovery system in Simulink, with the end goal of using the HDL coder to implement it on an FPGA.
I designed the algorithm in MATLAB first, and it works fine. However, translating it to Simulink is giving me trouble.
One of my first steps is to filter my data, which I implemented in MATLAB as
filfir2=fir1(100,[0.000001 8e6/Fs*2]); % Fs=30e6
data = filter(filfir2,1,data); %where data is the raw signal
Implementing the same thing in Simulink however, using the Digital Filter Designer (a 100 tap Hamming window direct form FIR with the same cutoff parameters, resulting in the same Bode plot), gives very different results with the same data:
The orange trace is the data filtered through the Simulink block, and the blue trace is the data filtered through Matlab and brought into Simulink with a From Workspace block.
I also tried
1) Importing my Simulink filter into Matlab and using it in Matlab before sending the filtered data to Simulink
2) Importing my Matlab filter (as a dffir block) into Simulink
Both performed identically to the original Matlab filter (i.e the blue trace).
I am wondering if there is a sample time issue or something where the actual simulation is what's causing the issue?
Thanks!
Ethan M.
Ethan Mokhttps://it.mathworks.com/matlabcentral/profile/authors/6899028-ethan-moktag:it.mathworks.com,2005:Question/4575722019-04-20T19:58:05Z2019-04-20T21:56:19ZHow to remove weekend from a TimeTable PlotHi!
I want to plot CandleStick pattern based on a TimeTable I have. In this case, I want to remove the gap on my chart caused by weekends. The following code simply remove the weekends from the timetable
T = T(~isweekend(T.DateTime),:);
However, I still have the gap when I plot the Candls since the xaxis shows the weekends gap! How can I remove this gap?
Siahttps://it.mathworks.com/matlabcentral/profile/authors/3787650-siatag:it.mathworks.com,2005:Question/4574722019-04-20T01:37:14Z2019-04-20T21:44:37ZHelp me understand the Classifier AppI am looking to create a classifier in Matlab, but I'm having some issues in understanding how exactly it works. I have several data sets of n x 9 arrays with readings from 3 separate 3-axis analog sensors (outputting values in m/s^2), and I want to create a classifier to distinguish between a state described by each of these arrays (walking, standing, running, etc.). I am having significant issue understanding how the classifier app in Matlab can train a model to do such a thing, however, and each time I attempt to "train" it, I get exceptionally poor model performance. I am obviously missing something key here, and I'm not sure where to go. I do have a fairly elementary understanding of classifiers, but I'm finding the documentation available to be confusing. Riley Stromhttps://it.mathworks.com/matlabcentral/profile/authors/6832935-riley-stromtag:it.mathworks.com,2005:Question/4575802019-04-20T21:01:51Z2019-04-20T21:43:57Zlimits are too large i have parametrized surface equation T(u,v)=e^(u^2+v^2) i + ln(2*v) j + tan(5*u) k . I used this code to plot it in 3D but it gives error 'limits are too large '. can yu help me pls.
clc; clear all ;
M = 100 ; N = 100 ;
uinf = 100 ;
u = linspace(0,uinf,M) ;
v = linspace(0,2*pi,N) ;
[U V] = meshgrid(u,v) ;
X = exp(U.^2+V.^2) ;
Y = log(2.*V) ;
Z = tan(5*U) ;
surf(X,Y,Z) ;Kuatra Patilhttps://it.mathworks.com/matlabcentral/profile/authors/15291254-kuatra-patiltag:it.mathworks.com,2005:Question/4575842019-04-20T21:19:53Z2019-04-20T21:42:57ZHow can I sort an array of structures based upon a particular field in MATLAB?
I've got a eeg_data_all(cell,size = 1*35), which contains 35*3 cells maybe. I want to sort these data by the 'subid'. How can I do this?Wenyi Xiaohttps://it.mathworks.com/matlabcentral/profile/authors/13762167-wenyi-xiaotag:it.mathworks.com,2005:Question/4574452019-04-19T21:15:37Z2019-04-20T21:42:54ZWriting equations in a matrix formHi MATLAB experts,
Could any one please help me to write-down the following equations into a matrix form? the initial value of c = zeros(I, L, K, M)
0<= c(i, j, k, m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M} and i = {1,...., I} and j = {1,..., L}
0<=sum_{j} sum_{i} c(i,j,k,m) <= 1 for all k= {1, 2, ...., K} and m = {1, 2, ..., M}Su sanhttps://it.mathworks.com/matlabcentral/profile/authors/14788079-su-santag:it.mathworks.com,2005:Question/4575872019-04-20T21:34:21Z2019-04-20T21:34:21Zplotting 3D curve and tangent at specified pointi have position vector r(t)=<t , t^2 , 2>, i have to plot it using plot3 function and also plot tangent at the point P(-1 , 1, 2) but i cant figure it out. can you help me please.Kuatra Patilhttps://it.mathworks.com/matlabcentral/profile/authors/15291254-kuatra-patiltag:it.mathworks.com,2005:Question/4575852019-04-20T21:25:47Z2019-04-20T21:29:38ZMATLAB system of ODEsdC/dt = (-exp((-10/(T+273)))*C
dT/dt = 1000*(exp((-10)/(T+273))*C-10*(T-20)
% Describe how C and T change for initial conditions of T=15 when C=1.
% Find C and T as a function of time.
% Plot the results on a single figure (would use two separate y-axes)
% Apologize for the formatting errors, but could someone help me write a script to perform these actions?Filip Jackowskihttps://it.mathworks.com/matlabcentral/profile/authors/9548942-filip-jackowskitag:it.mathworks.com,2005:Question/4575862019-04-20T21:27:41Z2019-04-20T21:27:41Zconvert from Longitude latitude to UPS( universal polar stereographic)Hey I am looking any simple way to convert from wgs 84 to UPS and vice versa .I've looked on site here in the tab file Exchange but I could not find any file with convert ups to wgs 84adam jakishttps://it.mathworks.com/matlabcentral/profile/authors/15337896-adam-jakistag:it.mathworks.com,2005:Question/4575822019-04-20T21:10:51Z2019-04-20T21:19:12ZConverting user input char to an array As part of my university matlab module i was assigned to do an assigment from one of 4 options. I'm on a bit of a road block, part of code is requesting the user to type in 6 numbers for a lottery game, being that this data is recorded as a char i want to convert this to a numerial array (matrix). I have tried the following with no luck.
player_numbers = input ('Please enter your number: ','s');
player_lotto_numbers = str2num(player_numbers);
Mehmet Saglamhttps://it.mathworks.com/matlabcentral/profile/authors/12224026-mehmet-saglamtag:it.mathworks.com,2005:Question/4575832019-04-20T21:11:11Z2019-04-20T21:16:14ZSolving integrals with Matlab % Numerical Integration
f(x)=int(sym('7+1/sqrt(1-x^2)',1/2,0))
I am stuck on this calculus problem. It is numerical integration, how do i write a code for this problem?It gives me error and i don't know what i am doing incorrectly.
The problem is f(x)= integral sign(7+1/sqrt(1-x^2)). Upper bound of integral sign is 1/2 and lower bound of integral sign is 0.
Jerald Johnsonhttps://it.mathworks.com/matlabcentral/profile/authors/15337747-jerald-johnsontag:it.mathworks.com,2005:Question/4567942019-04-16T21:36:07Z2019-04-20T21:09:43ZRTL generation error: Signal rate of value inf foundHi,
How do I resolve this RTL generation error: "Failed Native floating-point code generation cannot complete for the following reason(s): 'PID_Z_Drvr_Plus_Coil_And_Snubber1 Signal rate of value inf found"? I do not understand what "rate of value inf found" means, or where in the model to find it.
Thank you,
ShawnShawn Whitmanhttps://it.mathworks.com/matlabcentral/profile/authors/2927860-shawn-whitmantag:it.mathworks.com,2005:Question/579612013-01-04T13:04:14Z2019-04-20T21:02:24ZSimulating a Markov chainHello,
Would anybody be able to help me simulate a discrete time markov chain in Matlab?
I have a transition probability matrix with 100 states (100x100) and I'd like to simulate 1000 steps with the initial state as 1.
I'd appreciate any help as I've been trying to do this myself all week with no success and have not been able to source suitable code online.
Kind Regards
JohnJohnhttps://it.mathworks.com/matlabcentral/profile/authors/2960907-johntag:it.mathworks.com,2005:Question/4496942019-03-12T19:12:51Z2019-04-20T21:00:01ZTextanalytics Toolbox install fails with examples/textanalytics_glnxa64Hi,
i just want to install the toolbox via Apps-> get more apps -- and after start of installation (30 %) I get:
The following error was detected while installing examples/textanalytics_glnxa64: /home/xxxxxxxx/help/examples/textanalytics/glnxa64/ClassifyTextDataUsingDeepLearningExample_01.png (Datei oder Verzeichnis nicht gefunden) Would you like to retry installing examples/textanalytics_glnxa64? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_fa.log
The log isn helpfull:
(Mär 12, 2019 19:54:40) java.io.FileNotFoundException: /home/xxxxxxx/examples/textanalytics/glnxa64/ClassifyTextDataUsingDeepLearningExample_01.png (Datei oder Verzeichnis nicht gefunden)
at java.io.FileOutputStream.open0(Native Method)....
System: R2018b Student Licence @ Linux Mint 18.x; 4.15.0-46-generic
Any hint? Thanksfalkhttps://it.mathworks.com/matlabcentral/profile/authors/13726414-falktag:it.mathworks.com,2005:Question/4575782019-04-20T20:49:38Z2019-04-20T20:49:38Zgenerate key using primitive polynomial Hello
I want to create a key using primitive polynomial function of degree n over GF(2)
How can I get it?
i anyone know pls help me.
Ali
ammar mohammedhttps://it.mathworks.com/matlabcentral/profile/authors/14858931-ammar-mohammedtag:it.mathworks.com,2005:Question/4575772019-04-20T20:40:55Z2019-04-20T20:44:48ZHow to change negative values of matrix with for loops
Here is the program I am trying to write. So far, I have the user input code yet I do not know how to use the for loops.
Nicole Jeselsonhttps://it.mathworks.com/matlabcentral/profile/authors/15337828-nicole-jeselsontag:it.mathworks.com,2005:Question/4575762019-04-20T20:34:23Z2019-04-20T20:43:15ZCalibration of Spirometer Data Rafael Peraltahttps://it.mathworks.com/matlabcentral/profile/authors/10822895-rafael-peraltatag:it.mathworks.com,2005:Question/4575532019-04-20T17:13:26Z2019-04-20T20:42:25Zhow to plot a result .m file in gui?how can i display the result of a .m program in gui axes
here is my program it displays an image in hsv i put this image in the hsv1 attribute
how should I do it
thank you
function hsv()
img =imread('C:\Users\home\Documents\PFE\Cropedimg.jpg');
%img =imread('C:\Users\home\Documents\PFE\method\fing.jpg');
figure(1);
subplot(1,2,1)
img1=rgb2hsv(img);
%img1=rgb2hsv(img);
h = img1(:,:,1);s = img1(:,:,2);v = img1(:,:,3);
vv= retinex_frankle_mccann(v, 2);
hsv1=cat(3,(h),(s),(vv));
hsv1=hsv2rgb(hsv1);
subplot(1,2,2);
%figure;
imshow(hsv1);%the result img
title('ilimunation image');
Bekhtaoui Abdelhakimhttps://it.mathworks.com/matlabcentral/profile/authors/7850439-bekhtaoui-abdelhakimtag:it.mathworks.com,2005:Question/4575752019-04-20T20:28:15Z2019-04-20T20:40:22ZCommand is only executed when stepping through codeHi,
I am fairly new to Matlab App Designer and am running to a strange problem. Because my code is already getting fairly extensive I made a small app to reproduce the problem:
I have a clean new figure with a button using the callback function:
methods (Access = private)
% Button pushed function: Button
function ButtonPushed(app, event)
pos = app.Button.Position;
app.CenterAndScaleObj(app.UIFigure,0.9);
app.Button.Position = [pos(1), pos(2), pos(3), pos(4)];
end
end
and the following helper function:
methods (Access = public)
function CenterAndScaleObj(app, obj, scale2screen)
ScreenRes = get(0,'ScreenSize'); % Procedure om te zorgen dat window altijd in het midden staat incl. schaling t.o.v. beeldscherm
ScreenWidth = ScreenRes(3);
ScreenHeight = ScreenRes(4);
AppWidth = scale2screen * ScreenWidth;
AppHeight = scale2screen * ScreenHeight;
obj.Position = [ScreenWidth/2-AppWidth/2,ScreenHeight/2-AppHeight/2,AppWidth,AppHeight];
end
end
Nothing else is in the figure besides the stuff to create the figure and the button and the starting result is as follows:
The purpose is to resize the UIFigure with default position [ 100,100,320,240] to 90% of the screen height and width. This is done in the function CenterAndScaleObj and works like a charm. However the Button does not change position and end up on the upper left area of the figure instead of in the lower left area were I would like it to be.
To get around this I stored the original position of the button [13,13,100,22] in the variable pos. Then I rescale the figure and reset the button position using app.Button.Position = [pos(1), pos(2), pos(3), pos(4)]; Because the x and y position are relative to the lower left corner of the parent it should be moved to the lower left corner. However when I run this code the button stays at the upper left area. But! When I put a breakpoint at the line "app.Button.Position = [pos(1), pos(2), pos(3), pos(4)];" and step through the code the button moves to the lower left position.
I repeated this with and without the breakpoint and always got the same results. I even compiled it to an executable but the result is still that the button stays in the upper left area.
I also put a pause statement before the "app.Button.Position = [pos(1), pos(2), pos(3), pos(4)];" command to slow down the code but this does not help.
The problem does not only occur with buttons. It also occurs with panels, dropdowns and edit fields. (Did not check the others)
I am at a loss to what is causing this. Can anybody help?
kind regards,
BerryBerry Goossenshttps://it.mathworks.com/matlabcentral/profile/authors/14278060-berry-goossenstag:it.mathworks.com,2005:Question/4575442019-04-20T15:36:56Z2019-04-20T20:36:45Z How can I set a starting point in a situation where I have multiple variables?
I am trying to use the fmincon function in Optimtool.
My objective function is objecfun (w, d) and my constraint function is nonlconstr (w, d, g, x).
The variable w is a total of 30, d is 30, g is 6, and x is 3.
I entered a value within the constraint range of each variable at the starting point, but an error of 'x0: matched dimension of the concatenated matrix' occurred.
How do I set the starting point in optimtool?
I look forward to your reply. Thank you.TaeWan Kimhttps://it.mathworks.com/matlabcentral/profile/authors/15336820-taewan-kimtag:it.mathworks.com,2005:Question/4574652019-04-20T00:10:33Z2019-04-20T20:35:45ZVariable in a simulink state space matrixHow can I implement a matrix in a state space model in simulink that has a variable that is dependent on another component of the model signal such as an angle etc?
I have tried sending the signal to the workspace and calling in the matrix with a variable (of the same name) in it and it does not work.
Thank you.Sugshttps://it.mathworks.com/matlabcentral/profile/authors/6185328-sugstag:it.mathworks.com,2005:Question/4575212019-04-20T12:04:37Z2019-04-20T20:35:08Zfinding the slope and plotting it in graphi need to find the x,y points and plot those points finding the slope making a line in x,y plane. How can i get it automatically sisir regmihttps://it.mathworks.com/matlabcentral/profile/authors/12162188-sisir-regmitag:it.mathworks.com,2005:Question/1021942009-06-27T01:11:00Z2019-04-20T20:28:36ZHow can I speed up assignments to sparse matrices in MATLAB?How can I speed up assignments to sparse matrices in MATLAB?
I am assigning values to a sparse matrix which I have already created. However, this seems to be very slow. Is there a way to make this process faster?
MathWorks Support Teamhttps://it.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:it.mathworks.com,2005:Question/4575682019-04-20T19:28:25Z2019-04-20T20:26:59ZI get an error, what's wrong? on Sparse matrix logic and answer Write the function for
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
<</matlabcentral/answers/uploaded_files/215088/Screenshot_20190420-202641~2.png>>
Suraj Tawdehttps://it.mathworks.com/matlabcentral/profile/authors/14922923-suraj-tawdetag:it.mathworks.com,2005:Question/14272011-02-16T09:53:30Z2019-04-20T20:21:58ZWhat frustrates you about MATLAB?I love MATLAB. It is so quick and easy to write software to do what you want. It has excellent debugging and profiling tools. It is cross platform, making code easy to share (assuming the other people have forked out for the not-so-cheap license). It has interfaces to other software.
However, there are some things about it that irk me. I'd like to hear from other people what things annoy them about MATLAB.Oliver Woodfordhttps://it.mathworks.com/matlabcentral/profile/authors/1073021-oliver-woodfordtag:it.mathworks.com,2005:Question/4575632019-04-20T18:26:47Z2019-04-20T20:18:19Zinline function with 3 variables hello,
I'm trying to run this code but I don;t know how to write the function in a way that uses the values of h and t, then fx(a) and fx(b). can anyone please help
t = [5 6 7 8 9]
h= [2 3 4 5 6]
fx =inline('((2*pi.^2)./t)-(((9.81*2*pi)./x).*tanh((2*pi*h)./x))')
a = 1;
b = 10;
tol = 0.001;
fx(a)
fx(b)Nathan latchmanhttps://it.mathworks.com/matlabcentral/profile/authors/14512099-nathan-latchmantag:it.mathworks.com,2005:Question/4575702019-04-20T19:41:06Z2019-04-20T20:18:07Zi am trying to put my level curves and gradient vectors on same figure but i can'twell, it is a simple question i am new in MATLAB. i cannot put my gradient vectors and level curves on same figure, please help me.
here is my code.
f=@(x,y) 16*y.^2 + 9*x.^2;
g= gradient(f, [x, y])
figure(1)
[X, Y] = meshgrid(-1:.1:1,-1:.1:1);
z=f(X,Y);
contour(X,Y,z,[0:10])
G1 = subs(g(1), [x y], {X,Y});
G2 = subs(g(2), [x y], {X,Y});
quiver(X, Y, G1, G2)Kuatra Patilhttps://it.mathworks.com/matlabcentral/profile/authors/15291254-kuatra-patiltag:it.mathworks.com,2005:Question/4575522019-04-20T17:01:08Z2019-04-20T20:15:22Zhow to remove the repetitive elements from a structure>> a = struct('position', {[200 300 1],[300 200 1],[250 250 0.5],[230 280 0.6],[300 200 1],[270 150 1]}, 'cost', {[50;90],[60;80],[65;89],[60;70],[60;80],[55;85]})
I have a structure with two fields, I need to two remove the duplicates?
I tried useing the code below but it did not work.
[~, idx] = unique([a.position].', 'rows', 'stable'); %stable optional if you don't care about the order.
a = a(idx)
I hope I can find a sulotion for this problem.khalil alkebsihttps://it.mathworks.com/matlabcentral/profile/authors/6516458-khalil-alkebsitag:it.mathworks.com,2005:Question/4575242019-04-20T13:07:21Z2019-04-20T20:06:43ZSymbolic differentiation w.r.t with further use of the equationHello everyone,
i have a little problem to derivate my equation with respect to time.
My simple equation is:
syms q(t) % Variable q
f = sin(q); % Function
f_dot_dot = diff(f,t,2); % Second derivative w.r.t
And the result of f_dot_dot from Matlab is f_dot_dot = cos(q)*q_dot_dot - sin(q)*q_dot.
f_dot_dot(t) = cos(q(t))*diff(q(t), t, t) - sin(q(t))*diff(q(t), t)^2
Is it possible to reuse the upper equation in the interest of define the variable q(t) or diff(q(t), t, t) to solve my equation?
Best regards
MatthiasMatthias Zöggelerhttps://it.mathworks.com/matlabcentral/profile/authors/11733485-matthias-zoggelertag:it.mathworks.com,2005:Question/4575652019-04-20T18:54:40Z2019-04-20T20:03:46Zhow to get matlab 2019bHi,
I require to get /purchase Matlab 2019b. where to get it . as i am unable to find it in downloads. also what is the price for its licensing for 1 year .muhammad hannanhttps://it.mathworks.com/matlabcentral/profile/authors/15337508-muhammad-hannantag:it.mathworks.com,2005:Question/4572802019-04-18T23:32:05Z2019-04-20T20:01:03Zismember 0×0 empty logical array to logicHi All,
I have an array "A = [1 2 3 4 5 6]" which its length reduces in a loop
if ~ismember(A,ID)
do this
else
do that
end
This works fine until the A=[], which ismember returns
0×0 empty logical array
However I need a Single Value and not logical array. Note that I cannot use any and all functions to reduce Logical Arrays to Single Value, beacuse I faced with other problems when "A" array is not yet empty!
How can I fix this problem?Siahttps://it.mathworks.com/matlabcentral/profile/authors/3787650-siatag:it.mathworks.com,2005:Question/3883662018-03-14T23:24:32Z2019-04-20T19:59:10ZRemoving weekends and holidays from a TimeTableHow can one remove weekends and holidays entries from a TimeTable?
Thanks!Andreihttps://it.mathworks.com/matlabcentral/profile/authors/4508876-andrei