https://fr.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-04-21T14:01:57Ztag:fr.mathworks.com,2005:Question/4576602019-04-21T14:01:57Z2019-04-21T14:01:57ZNeed to find how many times in the matrix the Value 1 goes to Value 2I'm looking for a way to find the number of times a specific transition occurs between two values in a matrix A. Matrix A is 9x9 and has values ranging from 0 to 8. I need to find the number of times a value, say 5, is immediately followed by another value, say 2.
%This an example of matrix A
A=[1 3 4 0,4 2 3 1, 1 2 3 1]
For this matrix, I would need to find multiple combinations
1 to 3
4 to 0
3 to 1
etc.
I have no clue where to go with this. Thanks for any help.Jesse Valentinhttps://fr.mathworks.com/matlabcentral/profile/authors/9673201-jesse-valentintag:fr.mathworks.com,2005:Question/4549112019-04-07T13:23:01Z2019-04-21T13:59:00ZParameter estimation - How to input experiment data?Hi All,
I want to perform parameter estimation of the following ode model.
5 parameters have to be estimated after performing a least square error minimization of the cost function. The input that I have is steady state multi -experiment values of y1 to y10.
I found an example here that illustrated how to input time series experiment data. Could someone explain how to input staedy state multi-experiment data?
Deepa Maheshvarehttps://fr.mathworks.com/matlabcentral/profile/authors/8575091-deepa-maheshvaretag:fr.mathworks.com,2005:Question/4576562019-04-21T13:24:40Z2019-04-21T13:56:09Za and b constant HI, im new to matlab and was wondering how would you input a command to help me solve an unknown constant in an equation.
I have a bunch of x,y points,The equation would be x= a*y+bMOHAMED YHYAhttps://fr.mathworks.com/matlabcentral/profile/authors/15340840-mohamed-yhyatag:fr.mathworks.com,2005:Question/4576592019-04-21T13:49:02Z2019-04-21T13:49:02Z(Big data quality) find value in different column with specific length and value , then removeHi, In my Ph.D. I want to use bus tickets for big data(1 month data). You can see some row of data as below.
I need some check for my data quality before start analyzing.(clean my data)
I import my "b_data.csv" data as the table to Matlab, and now I have 8000000x9 Table.
now I want to clean up my data.
1- First missing cordinate check --> Check X and Y column to find " 0 " value then remove that row from my data.
2- Second, missing Ticket number check --->check the Ticket_number column and find the value not equal to 32 characters lenght then remove that row. ( because the card numbers all are 32 characters and I want to remove wrong data)
3- Third, missing Trip check--> In "T_type" column there are 10 Ticket type['ABilet','Bilet','Nbilet',...]. all ticket types have one tap-in(enter bus) records. And when they exit bus one tap-out(exit bus) record .Tap-out name for all type is "TBilet".
For example, one passenger with "Bilet" type enter to bus and tap-in, one row created with [B-ID T_type Ticket_Number T-ID X Y Time Line-1 Direction] ,
then at the end of the trip he tap-out his ticket and another row created with [B-ID T_type Ticket_Number T-ID X Y Time Line-1 Direction ].
In data "Ticket _number" is unique for each card. And tap-in record "T_ype" is "Bilet" and in the tap-out record "T_ype is "TBeilet".
So If I want to find missing trip: first In Similar "Time"(date) check the "T-type" and find all "TBilet" (exit bus) and related "Ticket_nimber" .A ticket number is unique. For each Ticket number find tap-in record(enter bus). And remove all rows without tap-in(enter bus) data. [[[[ in a simple word: each unique Ticket_number should have one enter the bus and exit bus data in same day. and I want to remove the Ticket_number without entering bus data.]]]]]
Can you please help me in my Thesis.( No matther in which step )
Thank you in advance.
(note: the Ram of my pc is 8GB but if it needs more Ram I can use another Pc with 32GB of Ram)
1 2 3 4 5 6 7 8 9
B-ID T_type Ticket_Number T-ID X Y Time Line-1 Direction
---------------------------------------------------------------------------------------------------------------------------------------
98 BILET 825BBBB05E6377E1573A42E10DBC725E 0 0.0000000 0.0000000 2018-10-02 21:50:04 10 0
339 BILET 40F9B4E6665E8508488B26BA790B0CE1 2 37.8733733 32.4941067 2018-10-06 15:12:47 1 0
307 BILET D5C94A1CCC1FDFA2AB44098DC1C03F03 1 37.8680850 32.4860500 2018-10-10 13:55:41 1 0
279 TBILET 1BCA1A1C15F6A251BA22065A814A714F 0 37.8734867 32.4940900 2018-10-12 18:29:01 31 1
225 BILET 553719969436F63DCEB334FC6D59B62E 37 37.8767500 32.4905800 2018-10-16 14:51:36 65 0
669 TBILET B066BFEE5AD5B40D1BF2E424EA07FCC1 37 37.8995867 32.4885267 2018-10-24 07:35:03 45 0
446 BILET 0470A8E7795385C676E633ED59B277C0 0 37.8934700 32.5042033 2018-10-29 07:39:41 44 2
297 BILET 7E7BC3DBA2A238C495BCCB9FF6BD0E73 37 37.8652667 32.5026067 2018-10-29 12:33:25 56 0
85 BILET A168B0A9EC65882DDC8AE98141F71317 0 37.8815450 32.4894250 2018-10-01 15:36:39 10 0
77 BILET 27D58D44E2F0634E198A49D340D35EE2 2 37.9250967 32.5079517 2018-10-01 18:12:08 10 0
922 BILET 5E12D36A521F76ED2C788EE1C3516BA3 0 37.8737417 32.4887733 2018-10-04 17:43:49 88 0
404 ABILET 8DC1227A7DDD632B8554CFC8AD8A6F72 2 37.8680417 32.4860850 2018-10-05 08:56:53 1 1
90 BILET 58FAD27C585CE6071B9538FF3F8CC9BD 2 0.0000000 0.0000000 2018-10-05 20:28:04 10 0
844 BILET 282BD42F1B5735EA17C467C8601BC5D9 2 37.8737633 32.4890850 2018-10-06 13:51:40 86 0Ali Afsharhttps://fr.mathworks.com/matlabcentral/profile/authors/15291311-ali-afshartag:fr.mathworks.com,2005:Question/4576582019-04-21T13:39:30Z2019-04-21T13:44:40ZMy filter is not working. I am using version 2018 A#Frequency responses using the rectangular and Hamming windows.
N=25;Ftype=1;WnL= 0:5*pi;WnH=0;Wtype=1;fs=8000;
%Design using the rectangular window;
Brec=firwd(N,Ftype,WnL,WnH,Wtype);
N=25;Ftype=1;WnL= 0:5*pi;WnH=0;Wtype=4;
%Design using the Hamming window;
Bham=firwd(N,Ftype,WnL,WnH,Wtype);
[hrec,f]=freqz(Brec,1,512,fs);
[hham,f]=freqz(Bham,1,512,fs);
prec= 180*unwrap(angle(hrec))/pi;
pham= 180*unwrap(angle(hham))/pi
subplot(2,1,1);
plot(f,20*log10(abs(hrec)),0-.0,f,20*log10(abs(hham)));grid
axis([0 4000 -100 10]);
xlabel('Frequency (Hz)');ylabel('Magnitude Response (dB)');
subplot(2,1,2);
plot(f,prec,0-.0,f,pham);grid
xlabel('Frequency (Hz)');ylabel('Phase (degrees)');Ruben Eduardo Montanohttps://fr.mathworks.com/matlabcentral/profile/authors/11726293-ruben-eduardo-montanotag:fr.mathworks.com,2005:Question/4575742019-04-20T20:13:56Z2019-04-21T13:44:29ZHow 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://fr.mathworks.com/matlabcentral/profile/authors/6314509-marlon-saveri-silvatag:fr.mathworks.com,2005:Question/4575412019-04-20T14:56:34Z2019-04-21T13:40:20Zregexrep 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://fr.mathworks.com/matlabcentral/profile/authors/28872-dpbtag:fr.mathworks.com,2005:Question/4576482019-04-21T11:34:07Z2019-04-21T13:39:19Zreturn row index of values greater than 0 to a 3 dimensional arrayI have a Matrix A, of m x n dimensions.
I wish to go through each row from left to right and return the index of values greater than 0. I have tried the folowing which returns the column index for the first row which has values. for example row 26
%% Now we have input matrix A we want to return the col index of each row element greater than 0. I have tried the following but i am not getting the outputmatrix with all entries. I fear entries are being overwritten
inputMatrix= A(2:end,:);
outputMatrix=zeros(1,[],size(A(2:end,:),2));
for i = 26:size(A(2:end,:),1)
for ij = 1:size(A(2:end,:),2)
[~,col] = find(inputMatrix(i,ij)>0);
%
outputMatrix=col;
end
end
However I wish to go through each row, and store these column indices in a 3 dimensional array where each page represents the set of column
indices from each row of A
I then want to use these column indices to return the value from the corresponding row of a matrix C and matrix D.
I then want to multiply C values by D values and return a 3 dimension array of results.
Any help appreciated.
Charleshttps://fr.mathworks.com/matlabcentral/profile/authors/5506466-charlestag:fr.mathworks.com,2005:Question/4576492019-04-21T12:09:36Z2019-04-21T13:39:13Zclear gui axes after plot?Hello everyone
I'm working on an interface for my project the program of my project contains step, each step is made by an individual program
I managed to do the 'load file' and the first step 'illumination normalization' so the load image is plotted in axes1 and the result of the 2nd step(illumination normalization) is plotted in axes2
now how can I put the 2nd result in the first axis and clear the axis 2 for the 3rd step. know that each step uses the result of the old step to work
here is the pushbutton part
text_eq='Illumination Normalization';
h=uicontrol(FigWin,...
'Style','pushbutton',...
'Position',[0,300,80,20],...
'String','Illumination Normalization',...
'Callback',...
['subplot(AxesHandle1);image1=ma_hsv(image1);imagesc(image1);title(text_eq);']);
text_SCT='Skin Color Thresholdin';
h=uicontrol(FigWin,...
'Style','pushbutton',...
'Position',[0,280,80,20],...
'String','SCT',...
'Callback',...
['subplot(AxesHandle2);image1=ma_SCT(image1);imagesc(image1);title(text_SCT);']);
here is the mistake I have
Error using subplot (line 209)
Requires valid axes handle for input.
Error while evaluating UIControl Callback.
Bekhtaoui Abdelhakimhttps://fr.mathworks.com/matlabcentral/profile/authors/7850439-bekhtaoui-abdelhakimtag:fr.mathworks.com,2005:Question/4576572019-04-21T13:36:11Z2019-04-21T13:36:11ZObtaining value of cost function from LQR? Is there anyway to actually extract the value of the cost function from LQR?
-thanks liamhttps://fr.mathworks.com/matlabcentral/profile/authors/15309607-liamtag:fr.mathworks.com,2005:Question/4553652019-04-09T19:04:56Z2019-04-21T13:28:02ZTimerFcn loop for arduino hi
I want to read some data from arduino with timer object and I want to read these data each 0.01 second as input datas and calculate datas and give output datas
the code that I want to use is:
t=timer('Period',0.01,'ExecutionMode','fixedRate');
t.TimerFcn=@(function1);
start(t)
function [T]=function1(x)
x=readCount(encoder);
k=5*x;
T=k+3;
end
is it correct?john whitehttps://fr.mathworks.com/matlabcentral/profile/authors/10514494-john-whitetag:fr.mathworks.com,2005:Question/4576552019-04-21T13:17:31Z2019-04-21T13:19:58ZHow to extract Markov features from an image using Transition probability matrixcan any one help me to extract markove fetures from an image using transition probability matrixMohammed Kassemhttps://fr.mathworks.com/matlabcentral/profile/authors/14083214-mohammed-kassemtag:fr.mathworks.com,2005:Question/4576542019-04-21T13:14:33Z2019-04-21T13:14:33ZHow do I extrapolate a point from a generated graph.So this is the question
The velocity (ms-1) of a car is measured every minute for 24 minutes and recorded as:
vel = [0 .45 1.79 4.02 7.15 11.18 16.09 21.90 29.05 29.05
29.05 29.05 29.05 22.42 17.9 17.9 17.9 17.9 14.34 11.01 8.9
6.54 2.03 0.55 0];
How long did the object take to pass 250m?
I have successfully generated a time against cummulative distance graph, but I'm stuck now.
Many thanksCheng-Han Yanghttps://fr.mathworks.com/matlabcentral/profile/authors/14131871-cheng-han-yangtag:fr.mathworks.com,2005:Question/4576532019-04-21T13:14:11Z2019-04-21T13:14:11ZHow to evaluate double integral of an irregular surface using Monte Carlo SimulationHi Everyone,
Please how can I use Monte Carlo Simulation to evaluate the double integral of an irregular surface. There is no defined function for this surface. All I was told is to generate a discretized matrice of 0 and 1 such that the evaluation is done with the elements of the matrice with 1 and the element with 0 aren't considered for the evaluation. The function to be used for evaluation is x^2 + y^2. If there are other viable methods you know, kindly help out on this
Thanks.Damilola Akamohttps://fr.mathworks.com/matlabcentral/profile/authors/14553500-damilola-akamotag:fr.mathworks.com,2005:Question/4575972019-04-20T23:10:47Z2019-04-21T13:11:15ZHow 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://fr.mathworks.com/matlabcentral/profile/authors/10865530-stelios-fanourakistag:fr.mathworks.com,2005:Question/1087432013-12-05T09:50:34Z2019-04-21T13:07:09Zswitch function in GUII am learning GUI through this youtube Video which is uploaded by matlab.
http://www.youtube.com/watch?v=czArO6PhdHM&src_vid=D_hmws6dwgg&feature=iv&annotation_id=annotation_896325
I tried to follow and write down everything but I got error message while using the pop up button. The related error is the usage of switch function.
here are parts of the code of the GUI.
- - - - - - - - - - - -
% --- Executes on selection change in popup1.
function popup1_Callback(hObject, eventdata, handles)
% hObject handle to popup1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,'String')) returns popup1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popup1
val = get (hObject,'Value');
str = get (hObject,'String');
switch str(val)
case 'peaks'
handles.current_data = handles.peaks;
case 'membrane'
handles.current_data = handles.membrane;
case 'sinc'
handles.current_data = handles.sinc;
end
guidata(hObject, handles);
- - - - - - - - - - - -
the error messages are:
??? SWITCH expression must be a scalar or string constant.
Error in ==> test2>popup1_Callback at 204
switch str(val)
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> test2 at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)test2('popup1_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
- - - - - - - - - - - -
Thank you.PChttps://fr.mathworks.com/matlabcentral/profile/authors/1060222-pctag:fr.mathworks.com,2005:Question/4575522019-04-20T17:01:08Z2019-04-21T13:00:06Zhow 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://fr.mathworks.com/matlabcentral/profile/authors/6516458-khalil-alkebsitag:fr.mathworks.com,2005:Question/4576522019-04-21T12:58:04Z2019-04-21T12:58:04Zhow to solve "Dot Indexing not supported for this type of variable" error I trained a Faster R-CNN network by following the trainfasterrcnn page but i am unable to test the network as i get the error below
"Dot indexing is not supported for variables of this type.
Error in fasterRCNNObjectDetector/parseDetectInputs (line 713)
networkInputSize = this.Network.Layers(this.LayerIndices.ImageLayerIdx).InputSize;
Error in fasterRCNNObjectDetector/detect (line 441)
params = this.parseDetectInputs(I, varargin{:});"
% load training data
load('FiveClassesTraining.mat');
TestImg = imread(trainingData.Imagefilename{70});
figure
imshow(TestImg)
% Run the detector
[bboxes,scores] = detect(detector,TestImg);
% Annotate detections in the image.
TestImg = insertObjectAnnotation(TestImg,'rectangle',bboxes,scores);
figure
imshow(TestImg)
Zainab Olalekanhttps://fr.mathworks.com/matlabcentral/profile/authors/12643982-zainab-olalekantag:fr.mathworks.com,2005:Question/4576512019-04-21T12:56:12Z2019-04-21T12:56:50ZPatch - Not enough input argumentsI am trying to create a rectangle where the sides all have different colors. I found another question asking about this, but the answer there didn't seem to work. This is the code I'm trying to run:
X = [0,1,1,0];
Y = [0,0,2,2];
C = [1,0,0;0,1,0;0,0,1;1,1,0];
patch(X,Y,'FaceVertexCData',C,'EdgeColor','flat','FaceColor','none','LineWidth',2)
Yet I always get this error message:
Error using patch
Not enough input arguments.
I don't understand what inputs are missing here. How do I fix this?Axel Sopphttps://fr.mathworks.com/matlabcentral/profile/authors/14513431-axel-sopptag:fr.mathworks.com,2005:Question/4576472019-04-21T11:32:28Z2019-04-21T12:53:18ZCan I ask for help in making a GUI? Hey there fellow Matlab users!
I'm quite new in the world of Matlab and I request for your help. Our professor is asking us to make a GUI for creating a graph.
Here is the project overview:
"Requirements:
Create a GUI that will show demonstrate different plots in Matlab.
The user will be asked for the values of x separated by commas in a textbox. If the user does not want to enter the x values, he can alternatively click a button to generate 100 random x double values from 1 to 100. The x values should be displayed in text once the “Graph” button has been clicked.
The user has the option to choose the type of graph to use in a radio button (plot, comet, stairs, stem)
The user has the option to choose the functions for which x would be evaluated in a checkbox (sin, cos, tan, exp, log, sqrt). If more than one function is checked, make sure that they all appear in a single figure using hold. The y values for each function selected should also be displayed in text once the “Graph” button has been clicked.
A button named “Graph” is available to start plotting the x values against the y values. Make sure that the resulting graph has appropriate title, labels and design. You are free to set any properties as you wish.'
classdef project_app < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TypeofgraphButtonGroup matlab.ui.container.ButtonGroup
PlotButton matlab.ui.control.RadioButton
CometButton matlab.ui.control.RadioButton
StemButton matlab.ui.control.RadioButton
StepButton matlab.ui.control.RadioButton
ValuesofXEditFieldLabel matlab.ui.control.Label
ValuesofXEditField matlab.ui.control.NumericEditField
FunctionsofXButtonGroup matlab.ui.container.ButtonGroup
SineCheckBox matlab.ui.control.CheckBox
CosineCheckBox matlab.ui.control.CheckBox
TangentCheckBox matlab.ui.control.CheckBox
LogarithmCheckBox matlab.ui.control.CheckBox
ExponentialCheckBox matlab.ui.control.CheckBox
SquarerootCheckBox matlab.ui.control.CheckBox
UIAxes matlab.ui.control.UIAxes
end
% Callbacks that handle component events
methods (Access = private)
% Value changed function: ValuesofXEditField
function ValuesofXEditFieldValueChanged(app, event)
end
% Value changed function: SineCheckBox
function SineCheckBoxValueChanged(app, event)
end
% Value changed function: CosineCheckBox
function CosineCheckBoxValueChanged(app, event)
end
% Value changed function: TangentCheckBox
function TangentCheckBoxValueChanged(app, event)
end
% Value changed function: LogarithmCheckBox
function LogarithmCheckBoxValueChanged(app, event)
end
% Value changed function: ExponentialCheckBox
function ExponentialCheckBoxValueChanged(app, event)
end
% Value changed function: SquarerootCheckBox
function SquarerootCheckBoxValueChanged(app, event)
end
end
% Component initialization
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create TypeofgraphButtonGroup
app.TypeofgraphButtonGroup = uibuttongroup(app.UIFigure);
app.TypeofgraphButtonGroup.TitlePosition = 'centertop';
app.TypeofgraphButtonGroup.Title = 'Type of graph ';
app.TypeofgraphButtonGroup.Position = [51 222 112 113];
% Create PlotButton
app.PlotButton = uiradiobutton(app.TypeofgraphButtonGroup);
app.PlotButton.Text = 'Plot';
app.PlotButton.Position = [11 67 43 22];
app.PlotButton.Value = true;
% Create CometButton
app.CometButton = uiradiobutton(app.TypeofgraphButtonGroup);
app.CometButton.Text = 'Comet';
app.CometButton.Position = [11 45 58 22];
% Create StemButton
app.StemButton = uiradiobutton(app.TypeofgraphButtonGroup);
app.StemButton.Text = 'Stem';
app.StemButton.Position = [11 23 50 22];
% Create StepButton
app.StepButton = uiradiobutton(app.TypeofgraphButtonGroup);
app.StepButton.Text = 'Step';
app.StepButton.Position = [11 2 47 22];
% Create ValuesofXEditFieldLabel
app.ValuesofXEditFieldLabel = uilabel(app.UIFigure);
app.ValuesofXEditFieldLabel.HorizontalAlignment = 'right';
app.ValuesofXEditFieldLabel.Position = [17 361 65 22];
app.ValuesofXEditFieldLabel.Text = 'Values of X';
% Create ValuesofXEditField
app.ValuesofXEditField = uieditfield(app.UIFigure, 'numeric');
app.ValuesofXEditField.ValueChangedFcn = createCallbackFcn(app, @ValuesofXEditFieldValueChanged, true);
app.ValuesofXEditField.Position = [97 361 100 22];
% Create FunctionsofXButtonGroup
app.FunctionsofXButtonGroup = uibuttongroup(app.UIFigure);
app.FunctionsofXButtonGroup.TitlePosition = 'centertop';
app.FunctionsofXButtonGroup.Title = 'Functions of X';
app.FunctionsofXButtonGroup.Position = [46 31 123 167];
% Create SineCheckBox
app.SineCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.SineCheckBox.ValueChangedFcn = createCallbackFcn(app, @SineCheckBoxValueChanged, true);
app.SineCheckBox.Text = 'Sine';
app.SineCheckBox.Position = [20 122 46 22];
% Create CosineCheckBox
app.CosineCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.CosineCheckBox.ValueChangedFcn = createCallbackFcn(app, @CosineCheckBoxValueChanged, true);
app.CosineCheckBox.Text = 'Cosine';
app.CosineCheckBox.Position = [20 101 59 22];
% Create TangentCheckBox
app.TangentCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.TangentCheckBox.ValueChangedFcn = createCallbackFcn(app, @TangentCheckBoxValueChanged, true);
app.TangentCheckBox.Text = 'Tangent';
app.TangentCheckBox.Position = [20 80 64 22];
% Create LogarithmCheckBox
app.LogarithmCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.LogarithmCheckBox.ValueChangedFcn = createCallbackFcn(app, @LogarithmCheckBoxValueChanged, true);
app.LogarithmCheckBox.Text = 'Logarithm';
app.LogarithmCheckBox.Position = [20 59 76 22];
% Create ExponentialCheckBox
app.ExponentialCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.ExponentialCheckBox.ValueChangedFcn = createCallbackFcn(app, @ExponentialCheckBoxValueChanged, true);
app.ExponentialCheckBox.Text = 'Exponential';
app.ExponentialCheckBox.Position = [20 38 85 22];
% Create SquarerootCheckBox
app.SquarerootCheckBox = uicheckbox(app.FunctionsofXButtonGroup);
app.SquarerootCheckBox.ValueChangedFcn = createCallbackFcn(app, @SquarerootCheckBoxValueChanged, true);
app.SquarerootCheckBox.Text = 'Square root';
app.SquarerootCheckBox.Position = [20 17 85 22];
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
title(app.UIAxes, 'Title')
xlabel(app.UIAxes, 'X')
ylabel(app.UIAxes, 'Y')
app.UIAxes.Position = [196 10 432 352];
% Show the figure after all components are created
app.UIFigure.Visible = 'on';
end
end
% App creation and deletion
methods (Access = public)
% Construct app
function app = project_app
% Create UIFigure and components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end
This is the code from making the GUI. I'm not even close to average nor are my groupmates and I feel really pathetic about that. So please, if there is anyone out there who can spare their time to help, please do. I only have two days for this project and I would gladly love a hand. Thank you so much again. I would also like to be able to call you if it's alright with you as I have too many questions that can't be asked by simple text. Dave Rafael Dador Diezhttps://fr.mathworks.com/matlabcentral/profile/authors/14634736-dave-rafael-dador-dieztag:fr.mathworks.com,2005:Question/4576452019-04-21T10:44:39Z2019-04-21T12:45:29ZHow do I get some part of my boxplot labels italic? I can not change the Interpreter to 'tex' somehow? Why? How can I work around? I kind of have the same problem, which was asked here:
https://de.mathworks.com/matlabcentral/answers/30338-question-about-labels-under-each-boxplot
I want to have some parts of labels for boxplot italic but it just writes "\it" out. Somehow I cannot change the Interpreter to 'text'.
Also why is there no proper handle for the boxplot function like for any other plot?
This solution does not work! (MATLAB R2017a) The labels are still NOT italic and \it is still written there.
dados = rand(100,2);
boxplot(dados,'labels',{'\bf\it{IDEB}_2_0_0_7','\bf Efficiencies'})
h = findobj(gca, 'type', 'text');
set(h, 'Interpreter', 'tex');Tom Cookhttps://fr.mathworks.com/matlabcentral/profile/authors/15340138-tom-cooktag:fr.mathworks.com,2005:Question/4575722019-04-20T19:58:05Z2019-04-21T12:42:31ZHow 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://fr.mathworks.com/matlabcentral/profile/authors/3787650-siatag:fr.mathworks.com,2005:Question/4575872019-04-20T21:34:21Z2019-04-21T12:33:23Zplotting 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://fr.mathworks.com/matlabcentral/profile/authors/15291254-kuatra-patiltag:fr.mathworks.com,2005:Question/4575372019-04-20T14:48:40Z2019-04-21T12:32:02ZHow can I use loops to perform different functions on every other array element?Hello. If I want to create a column vector where I specify the value of the first element and then use loops to automatically generate values for the rest based on two different functions that are carried out alternatively until the vector is a specific size, how would I do this?
For instance, my input could be 100, and the code would generate a vector:
100
60
70
42
52
31.2
41.2
24.72
etc. for a given number of times where the two different functions are:
n = (n-1)*0.6
for all even values of n, and:
n = (n-1)+10
for all odd values of n apart from 1.
I'm sorry that I don't have any code to show but I am just starting with matlab and I honestly don't know where to start with this even after extensive googling.
Thank you in advance for helping :)Joe Williamshttps://fr.mathworks.com/matlabcentral/profile/authors/9004919-joe-williamstag:fr.mathworks.com,2005:Question/4576292019-04-21T07:12:42Z2019-04-21T12:23:10Z Write a MTALB code that can find the area of a surface in any coordinate system. The user must select which coordinate system is required and specify the limits. Then, the code should calculate the required output.How can i solve this Question?Abdulrahman Almaqrashihttps://fr.mathworks.com/matlabcentral/profile/authors/15339350-abdulrahman-almaqrashitag:fr.mathworks.com,2005:Question/4576502019-04-21T12:13:09Z2019-04-21T12:13:09Z is ccs v9 supported by matlab R2019a ?I want to know which code composer studio version is supported by MATLAB R2019a version, is ccs v9 supported ?...and how to configure it in MATLAB ?Sanya Godehttps://fr.mathworks.com/matlabcentral/profile/authors/15053906-sanya-godetag:fr.mathworks.com,2005:Question/4569502019-04-17T14:26:41Z2019-04-21T11:37:20ZSymbolic system of odesHey!
So, I've been working on this physics problem where I face a system of four coupled differential equations which I can't seem to find the answer to
TT0 = 0; %initial release angle Theta
l0 = 1; %initial left line length (in meters)
m = 1;
M = 3;
R = 0.3;
g = 9.8;
mu = 0.5;
syms t Ti(t) Tx(t) TT(t) l(t);
ode1 = (M*g) - Tx == -M*(diff(l,t,2)+R*diff(TT,t,2));
ode2 = m*g*sin(TT) - Ti == m*(R*diff(TT,t,2)-l*(diff(TT,t))^2 + diff(l,t,2));
ode3 = m*g*cos(TT) == m*(R*(diff(TT,t))^2 + 2*diff(l,t)*diff(TT,t) + l*diff(TT,t,2));
ode4 = Tx == Ti*exp(mu*(pi/2 + TT));
odes = [ode1; ode2; ode3; ode4];
conds = [TT(0) == TT0; l(0) == l0;Ti(0) == 0; Tx(0) == M*g];
D = dsolve(odes,conds);
Here's the code I've written. There are four equations and four indeterminates but I get this error when I run the code:
"
Error using mupadengine/feval (line 163)
Cannot reduce to the square system because the number of equations differs from the number of indeterminates.
Error in dsolve>mupadDsolve (line 332)
T = feval(symengine,'symobj::dsolve',sys,x,options);
Error in dsolve (line 193)
sol = mupadDsolve(args, options);
Error in Untitled (line 16)
D = dsolve(odes,conds)
"
I've searched the internet and altered my code several times but it didn't seem to work. I'll highly appreciate any kind of help. Thanks. Web Junkiehttps://fr.mathworks.com/matlabcentral/profile/authors/15318641-web-junkietag:fr.mathworks.com,2005:Question/4576392019-04-21T09:22:32Z2019-04-21T11:34:55ZWhile conditioning to any element of an arrayHello,
I am trying to get an input as an array, then i want to check if every element of array suits the condition. If not i would like to ask for another input
Here is my code;
As you can see the input mass (ex. [ 1 2 3 4 5 ]) must be between 1-100. If any element does not satisfy this condition (ex. [1 2 -3 -4 500]), the program must again ask for the input.
When I write any kind of values MATLAB says there is a error at line 7 (line with while condition). It says "Operands to the || and && operators must be convertible to logical scalar values."
How can I avoid this error?
Thanks in advance.
mo = input('Enter values for mass (mo): ');
nmo = numel(mo);
k=1:nmo;
while mo(k)<1 || mo(k)>100
fprintf('Mass must be between 1-100.\n');
mo = input('Enter values for mass (mo): ');
end
Can Özcanhttps://fr.mathworks.com/matlabcentral/profile/authors/9773694-can-ozcantag:fr.mathworks.com,2005:Question/4576412019-04-21T09:49:03Z2019-04-21T11:30:11Zinterp2 ... How does it work? Hello guys,
I'm looking to find a mathematical basis for explaining the interpolation methods for "linear", "cubic", "nearest", "makima" and "spline" of function interp2. Matworks webside is very brief. I have matrix of numbers for example:
a = rand(4);
Vq = interp2(a,1,'method')
and I want compute only finite values.
Any help?
Best regardsmartin martinhttps://fr.mathworks.com/matlabcentral/profile/authors/9175560-martin-martintag:fr.mathworks.com,2005:Question/4575432019-04-20T15:32:57Z2019-04-21T11:29:00ZHow to change color for stacked bar chart Hi
I am wondering how I can change the color of the bars in a stacked bar chart. The code below gives me the error message "Expected one output from a curly brace or dot indexing expression, but there were 2 results." I wanted to apply blue \ hatch on the gray column, but so far I am not even able to change the color of the bars. I am able to make all bars in blue hatch \ with white background.
I have added a png to show what I want. I changed the colors in the png after running the script with the mouse, and therefor I do not have the option to export the figure as eps (better quality) with correct colors.
ba = bar(y,'stacked', 'FaceColor','flat');
ba.CData(1,:) = [0.5 0.5 0.5]
ba.CData(2,:) = [0 0 1]
applyhatch_plusC(gcf,'\','b');Andreas Grøvan Aspaashttps://fr.mathworks.com/matlabcentral/profile/authors/11483650-andreas-grovan-aspaastag:fr.mathworks.com,2005:Question/4573062019-04-19T02:50:03Z2019-04-21T11:27:34ZArtificial Neural Network implementation and to know the importance of each of the input on output(Response) - wanted helpI Conducted 27 experiments for a 10-factor,3-level design of experiments. I conducted these experiments on a decentralized production-distribution supply chain on a desktop computer to understand the effect (importance) of each of the 10 factors on the total supply chain cost (Response).
These experiments are computer simulations.
The 10 factors considered were namely, Tardiness cost (shortage cost at customer zone) ,(TarC), Earliness cost at the Distribution centre (EarC), Transportation cost between factories and Distribution centers (TransFDC), Transportation cost between Distribution centers and Customer Zones (TransDCCU), Production Cost of Products at Factory (ProdC), Inventory holding cost at factory (InvC), Unfulfilled cost (Shortage cost at factory (UnfulfillC), capacity of factory (CapaF), Maximum earliness allowed (Capae), Inventory holding capacity at factory(Capaif)
For each of the 10 factors, I have chosen 3-levels (1,2,3).
1-represents low,2-represents medium, 3-represents high.
I have assigned values for these 3 levels for each of the 10-factors as shown in Table.1(Attachment) . For instance for Tardiness Cost (1stfactot).,i.e, TarC, level 1 represents a value between 100 and 500. For the same TarC , level-2 represents a value between 500 and 1000. Level-3 for TarC represents a value between 1000 and 5000. Like above, the 3-level values have been assigned for all the 10-factors.
The settings of parameters for conducting experiments have been shown in Table.2.(Attachment)
The Total cost (Table.3) of the Decentralized supply chain has been obtained by solving the above 10-factor experiments using a G.A.M.S. modeling language for optimizing the cost. The total cost (Response) for the 27 experiments was shown in Table.3.(Attachment)
I want to implement the above inputs(factors), Targets(Responses) in Artificial Neural Network of MATLAB to know the impact (importance) of each of the 10-factors on total cost (Response) of the decentralized supply chain.
can somebody help me in implementing the data shown in the attachment for using ANN to know the importance of each of the 10 factors on total supply chain costKallam Haranadha Reddyhttps://fr.mathworks.com/matlabcentral/profile/authors/5909596-kallam-haranadha-reddytag:fr.mathworks.com,2005:Question/4576202019-04-21T05:09:37Z2019-04-21T11:25:50Zi need to convert a folder of 200 .jpg images to .mat (to create 200 separate .mat files). i know there should be an easy matlab for loop to do this but I need help (newbie). thanks!i need to convert a folder of 200 .jpg images to .mat (to create 200 separate .mat files). i know there should be an easy matlab for loop to do this but I need help (newbie). thanks!Esther Meadhttps://fr.mathworks.com/matlabcentral/profile/authors/15333278-esther-meadtag:fr.mathworks.com,2005:Question/4387652019-01-08T13:24:43Z2019-04-21T11:03:49ZCalculate slope of a discrete pointsHi all,
Can anyone please help me to find the instantaneous gradient (slope) at each points from the following datasets.
data=[
% X Y
%===================
0.7761 0.5715
0.794 0.5729
0.8117 0.5744
0.8292 0.5762
0.8465 0.5782
0.8637 0.5804
0.8807 0.5828
0.8977 0.5853
0.9144 0.5879
0.9311 0.5907
0.9477 0.5937
0.9641 0.5968
0.9805 0.6
0.9967 0.6033
1.0129 0.6067
1.0289 0.6103
1.0449 0.6139
1.0608 0.6176
1.0767 0.6215
1.0924 0.6254
1.1081 0.6294
1.1238 0.6334
1.1393 0.6376
1.1548 0.6418
1.1703 0.6461
1.1857 0.6505
1.201 0.6549
1.2163 0.6593
1.2316 0.6639
1.2468 0.6685
1.2619 0.6731
1.277 0.6778
1.2921 0.6825
1.3071 0.6873
1.3221 0.6921
1.3371 0.697
1.352 0.7019
1.3669 0.7069
1.3818 0.7119
1.3966 0.7169
1.4114 0.722
1.4262 0.727
1.441 0.7322
1.4557 0.7373
1.4704 0.7425
1.4851 0.7477
1.4997 0.753
1.5143 0.7583
1.5289 0.7635
1.5435 0.7689
1.5581 0.7742
1.5726 0.7796
1.5872 0.785
1.6017 0.7904
1.6162 0.7958
1.6307 0.8013
1.6451 0.8067
1.6596 0.8122
1.674 0.8178
1.6884 0.8233
1.7028 0.8288
1.7172 0.8344
1.7315 0.84
1.7459 0.8456
1.7602 0.8512
1.7746 0.8568
1.7889 0.8624
1.8032 0.8681
1.8175 0.8737
1.8318 0.8794
1.8461 0.8851
1.8603 0.8908
1.8746 0.8965
1.8888 0.9023
1.9031 0.908
1.9173 0.9137
1.9315 0.9195
1.9457 0.9253
1.9599 0.931
1.9741 0.9368
1.9883 0.9426
2.0025 0.9484
2.0166 0.9543
2.0308 0.9601
2.0449 0.9659
2.0591 0.9718
2.0732 0.9776
2.0874 0.9835
2.1015 0.9893
2.1156 0.9952
2.1297 1.0011
2.1438 1.007
2.1579 1.0128
2.172 1.0187
2.1861 1.0247
2.2002 1.0306
2.2143 1.0365
2.2284 1.0424
2.2425 1.0483
2.2565 1.0543];
The plot of the dataset is shown below
I have calculated the slope based on the two neighboring points, the results is copied below.
the gradient (m) is calculated using the following formula:
and the angle is just the arc-tan of the result.
Now, is it possible to obtain the instantaneous slope (gradient) at each point without using any curve-fitting to find the equation of the dataset? How can we do this numerically?
out =[
% X Y m atan atandeg
%================================================================
0.7761 0.5715
0.794 0.5729 0.078212291 0.078053394 4.472130064
0.8117 0.5744 0.084745763 0.084543756 4.844000375
0.8292 0.5762 0.102857143 0.102496699 5.872628281
0.8465 0.5782 0.115606936 0.115096 6.594515032
0.8637 0.5804 0.127906977 0.127216217 7.288952324
0.8807 0.5828 0.141176471 0.14024961 8.035710711
0.8977 0.5853 0.147058824 0.146012258 8.365886124
0.9144 0.5879 0.155688623 0.154448697 8.849258471
0.9311 0.5907 0.167664671 0.166119551 9.517949161
0.9477 0.5937 0.180722892 0.178793055 10.24408745
0.9641 0.5968 0.18902439 0.186820161 10.70400675
0.9805 0.6 0.195121951 0.192700759 11.04094018
0.9967 0.6033 0.203703704 0.200954264 11.51383118
1.0129 0.6067 0.209876543 0.206873949 11.85300417
1.0289 0.6103 0.225 0.221314442 12.68038349
1.0449 0.6139 0.225 0.221314442 12.68038349
1.0608 0.6176 0.232704403 0.228635393 13.09984308
1.0767 0.6215 0.245283019 0.240534248 13.78159724
1.0924 0.6254 0.248407643 0.243479414 13.95034281
1.1081 0.6294 0.25477707 0.249469651 14.29355811
1.1238 0.6334 0.25477707 0.249469651 14.29355811
1.1393 0.6376 0.270967742 0.264613602 15.16124258
1.1548 0.6418 0.270967742 0.264613602 15.16124258
1.1703 0.6461 0.277419355 0.270614072 15.50504418
1.1857 0.6505 0.285714286 0.278299659 15.9453959
1.201 0.6549 0.287581699 0.280025283 16.04426686
1.2163 0.6593 0.287581699 0.280025283 16.04426686
1.2316 0.6639 0.300653595 0.292056315 16.73359422
1.2468 0.6685 0.302631579 0.293869335 16.83747263
1.2619 0.6731 0.304635762 0.295704342 16.94261077
1.277 0.6778 0.311258278 0.30175322 17.28918598
1.2921 0.6825 0.311258278 0.30175322 17.28918598
1.3071 0.6873 0.32 0.309702945 17.74467163
1.3221 0.6921 0.32 0.309702945 17.74467163
1.3371 0.697 0.326666667 0.315738603 18.09048937
1.352 0.7019 0.32885906 0.317718318 18.20391871
1.3669 0.7069 0.33557047 0.323762624 18.55023193
1.3818 0.7119 0.33557047 0.323762624 18.55023193
1.3966 0.7169 0.337837838 0.325799115 18.66691427
1.4114 0.722 0.344594595 0.331851221 19.01367439
1.4262 0.727 0.337837838 0.325799115 18.66691427
1.441 0.7322 0.351351351 0.337878188 19.35899418
1.4557 0.7373 0.346938776 0.333945072 19.13364321
1.4704 0.7425 0.353741497 0.340004105 19.48080023
1.4851 0.7477 0.353741497 0.340004105 19.48080023
1.4997 0.753 0.363013699 0.348220949 19.95159069
1.5143 0.7583 0.363013699 0.348220949 19.95159069
1.5289 0.7635 0.356164384 0.342155885 19.60408815
1.5435 0.7689 0.369863014 0.354259423 20.29756977
1.5581 0.7742 0.363013699 0.348220949 19.95159069
1.5726 0.7796 0.372413793 0.356501385 20.42602476
1.5872 0.785 0.369863014 0.354259423 20.29756977
1.6017 0.7904 0.372413793 0.356501385 20.42602476
1.6162 0.7958 0.372413793 0.356501385 20.42602476
1.6307 0.8013 0.379310345 0.362544237 20.77225468
1.6451 0.8067 0.375 0.35877067 20.55604522
1.6596 0.8122 0.379310345 0.362544237 20.77225468
1.674 0.8178 0.388888889 0.370891289 21.25050551
1.6884 0.8233 0.381944444 0.364845007 20.90407908
1.7028 0.8288 0.381944444 0.364845007 20.90407908
1.7172 0.8344 0.388888889 0.370891289 21.25050551
1.7315 0.84 0.391608392 0.373251365 21.38572793
1.7459 0.8456 0.388888889 0.370891289 21.25050551
1.7602 0.8512 0.391608392 0.373251365 21.38572793
1.7746 0.8568 0.388888889 0.370891289 21.25050551
1.7889 0.8624 0.391608392 0.373251365 21.38572793
1.8032 0.8681 0.398601399 0.379300105 21.73229519
1.8175 0.8737 0.391608392 0.373251365 21.38572793
1.8318 0.8794 0.398601399 0.379300105 21.73229519
1.8461 0.8851 0.398601399 0.379300105 21.73229519
1.8603 0.8908 0.401408451 0.381719969 21.87094317
1.8746 0.8965 0.398601399 0.379300105 21.73229519
1.8888 0.9023 0.408450704 0.387770172 22.21759427
1.9031 0.908 0.398601399 0.379300105 21.73229519
1.9173 0.9137 0.401408451 0.381719969 21.87094317
1.9315 0.9195 0.408450704 0.387770172 22.21759427
1.9457 0.9253 0.408450704 0.387770172 22.21759427
1.9599 0.931 0.401408451 0.381719969 21.87094317
1.9741 0.9368 0.408450704 0.387770172 22.21759427
1.9883 0.9426 0.408450704 0.387770172 22.21759427
2.0025 0.9484 0.408450704 0.387770172 22.21759427
2.0166 0.9543 0.418439716 0.396300932 22.70637084
2.0308 0.9601 0.408450704 0.387770172 22.21759427
2.0449 0.9659 0.411347518 0.390250283 22.35969418
2.0591 0.9718 0.415492958 0.39379062 22.56254053
2.0732 0.9776 0.411347518 0.390250283 22.35969418
2.0874 0.9835 0.415492958 0.39379062 22.56254053
2.1015 0.9893 0.411347518 0.390250283 22.35969418
2.1156 0.9952 0.418439716 0.396300932 22.70637084
2.1297 1.0011 0.418439716 0.396300932 22.70637084
2.1438 1.007 0.418439716 0.396300932 22.70637084
2.1579 1.0128 0.411347518 0.390250283 22.35969418
2.172 1.0187 0.418439716 0.396300932 22.70637084
2.1861 1.0247 0.425531915 0.402321098 23.05130092
2.2002 1.0306 0.418439716 0.396300932 22.70637084
2.2143 1.0365 0.418439716 0.396300932 22.70637084
2.2284 1.0424 0.418439716 0.396300932 22.70637084
2.2425 1.0483 0.418439716 0.396300932 22.70637084
2.2565 1.0543 0.428571429 0.404891786 23.19859051];BeeTiawhttps://fr.mathworks.com/matlabcentral/profile/authors/318942-beetiawtag:fr.mathworks.com,2005:Question/80322011-05-23T14:57:16Z2019-04-21T10:59:54ZQuiver scale variables differently?Hello. I have this problem.
I have two different types of flux/velocity variables (in u and v) that I want to compare using a quiver plot. The problem is that one of the variables is scaled a LOT bigger than the other variable, no matter the actual physical values it has. For examplem, if I force it smaller by multiplying by 0.001 or something, it STILL shows these huge arrows. That is, variable 2 has longer quiver arrows than variable 1 even though the values it has is smaller.
ps; I've tried to set 'autoscaling','off', but it doesn't help.
What's going on? :/JEC PsiComhttps://fr.mathworks.com/matlabcentral/profile/authors/2275023-jec-psicomtag:fr.mathworks.com,2005:Question/1795992015-02-21T19:58:29Z2019-04-21T10:57:55ZHow can I calculate the slope of a line given two points?I need a function which can output the slope of a 2D line given two points. Ofcourse, I could just use m = (y2-y1)/(x2-x1), however, I have a long list of points/lines which I need to find the slope of and I don't believe this would be the most efficient method.
Something similar to the pdist2(point_a, point_b) function which I've previously used to find the distance between two points would be ideal.
Thanks in advance.
Neal Younghttps://fr.mathworks.com/matlabcentral/profile/authors/6204447-neal-youngtag:fr.mathworks.com,2005:Question/4575452019-04-20T15:44:12Z2019-04-21T10:54:34ZHow to delete a pushbutton with a given 'String' from a .fig fileHi
I am making a GUI. There is one problem .
I have a pushbutton with 'string' of 'Calculate'. A copy of this pushbutton ( with 'string' of 'Calculate') appears when I run the .fig file undesired.
But I cannot see this unwanted pushbutton in the .fig file, so I am unable to delete it.
How to delete the this unwanted pushbutton ???
Plz help.
Pankaj Jhahttps://fr.mathworks.com/matlabcentral/profile/authors/7587896-pankaj-jhatag:fr.mathworks.com,2005:Question/4575212019-04-20T12:04:37Z2019-04-21T10:42:58Zfinding 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://fr.mathworks.com/matlabcentral/profile/authors/12162188-sisir-regmitag:fr.mathworks.com,2005:Question/4575462019-04-20T15:52:34Z2019-04-21T10:40:31ZPeriodic function. How would I make this function repeat itself for, let's say, -1 to 3 seconds or something? clear;clc;
Vm =1 ; % Amplitude of signal T= 1 ; % Period
syms t;
v1 = Vm*sin((4*pi*t)/T);
v2= 2*Vm*sin((4*pi*t)/T);
v = piecewise(0<=t<=T/2,v1,T/2<=t<=T,v2);
figure;
fplot (t,v) ;
grid on xlabel('time s ');
ylabel('Voltage V ');
title('v(t) vs t ');
legend('v ')MATLAB Dummyhttps://fr.mathworks.com/matlabcentral/profile/authors/13339015-matlab-dummytag:fr.mathworks.com,2005:Question/303382012-02-26T17:34:14Z2019-04-21T10:37:11ZQuestion about labels under each boxplot.Dear all,
I need to put labels under each boxplot. To do this, I'm using:
boxplot([dados(:,1),dados(:,2)],'labels',{'bf\it{IDEB}_2_0_0_7'},{'\bfEfficiencies'})
Unfortunately, I don´t have sucess.
Can someone help me?
Best regards.
Marcus ViniciusMarcus Vinicius Pereira de Souzahttps://fr.mathworks.com/matlabcentral/profile/authors/1180120-marcus-vinicius-pereira-de-souzatag:fr.mathworks.com,2005:Question/4575322019-04-20T14:19:06Z2019-04-21T10:30:46Zhow to align the line detected to the middle of the imageThe two transmission line is detected and then how can I align that two blue lines to the middle of the image which are symmetricallyPEIYU LIMhttps://fr.mathworks.com/matlabcentral/profile/authors/14981630-peiyu-limtag:fr.mathworks.com,2005:Question/4576442019-04-21T10:27:27Z2019-04-21T10:27:27Zwhat unit does simscape engine fuel consumption outputSo I have a simscape model of a hybrid vehicle and I would like to find out the fuel consumption.
I have used the simscape driveline generic engine which has an output of fuel consumption rate.
I used the fuel consumption model of constant per revolution in mg/rev.
However I do not know the units of which the engine gives as an output. Apparently it is a fuel consumption rate but i dont know of what units!!!!Angus Brucehttps://fr.mathworks.com/matlabcentral/profile/authors/9137635-angus-brucetag:fr.mathworks.com,2005:Question/4575202019-04-20T11:50:25Z2019-04-21T10:10:39ZTwo graphs at the same time PLEASE HELP
Hello,
I have this code that is used with arduino package
the code will be used to get data from two sensors:
load cell that measures load
displacement sensor that measures displacement
problems:
this code is showing two graphs but only one graph has labels
only one graph is showing data results
this is the code: (please note that i'm new to MATLAB and coding in general)
clear
clc
a=arduino('com3','Uno')
loadcell=addon(a,'ExampleAddon/HX711',{'D2','D3'})
plotTitle1 = 'Load VS Time';
xLabel1 = 'Elapsed Time (s)';
yLabel1 = 'Load (KN)';
legend1 = 'Load Cell 1'
plotTitle2 = 'Displacement VS Time';
xLabel2 = 'Elapsed Time (s)';
yLabel2 = 'Displacement (mm)';
legend2 = 'Displacement Sensor 1'
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
yMax1 = 10000000
yMin1 = 0
yMax2 = 10000000
yMin2 = 0
plotGrid = 'on';
min1 = 0;
max1 = 10000;
min2 = 0;
max2 = 10000;
delay = .001;
time = 0;
data1 = 0;
data11 = 0;
data12 = 0;
data2 = 0;
data21 = 0;
data22 = 0;
count = 0;
subplot(2,4,1)
plotGraph1 = plot(time,data1,'-r')
subplot(2,4,2)
plotGraph2 = plot(time,data2,'-r')
hold on
title(plotTitle1,'FontSize',5);
xlabel(xLabel1,'FontSize',5);
ylabel(yLabel1,'FontSize',5);
axis([yMin1 yMax1 min1 max1]);
title(plotTitle2,'FontSize',5);
xlabel(xLabel2,'FontSize',5);
ylabel(yLabel2,'FontSize',5);
axis([yMin2 yMax2 min2 max2]);
grid(plotGrid);
tic
figure (1)
while ishandle(plotGraph1)
dat1 = read_HX711(loadcell)-1940.225269
count = count + 1;
time(count) = toc;
data1(count) = dat1(1);
set(plotGraph1,'XData',time,'YData',data1);
axis([0 time(count) min1 max1]);
pause(delay);
end
hold on
figure (2)
while ishandle(plotGraph2)
dat2 = readVoltage(a,'A0')*80
count = count + 1;
time(count) = toc;
data2(count) = dat2(1);
set(plotGraph2,'XData',time,'YData',data2);
axis([0 time(count) min2 max2]);
pause(delay);
end
hold off
delete(a);
disp('Plot Closed and arduino object has been deleted');
Ameen Mouazzenhttps://fr.mathworks.com/matlabcentral/profile/authors/14732767-ameen-mouazzentag:fr.mathworks.com,2005:Question/1422712014-07-17T18:48:29Z2019-04-21T09:48:08ZMatlab seems to install fine, but will not run in Ubuntu 14.04, no error message providedI've installed Matlab R2014a on Ubuntu 14.04 server (with ubuntu-desktop installed). Everything seemed to go fine with the installation - no errors were reported. When I try to run matlab from a terminal window, nothing happens. No error messages are reported. "top" reveals 0% CPU and 0.1% memory used by the MATLAB process. CTRL-C does not kill the process - I have to kill it manually with the kill command. Adding the -debug or -nojvm or -nodesktop arguments does not alter this behavior.
I know that 14.04 is not officially supported yet, but there are reports of it working out there. I'm kind of stuck with no information. Does anyone have any suggestions about what to try? Is there some way for me to get additional troubleshooting data?
Thanks,
Kyle
Kylehttps://fr.mathworks.com/matlabcentral/profile/authors/5468058-kyletag:fr.mathworks.com,2005:Question/4576332019-04-21T08:02:18Z2019-04-21T09:41:16ZExtract Previous Cell ValueI have a cell with char values next to each other as seen below
Cell 1 | Cell 2
____________
'Hello' | 'World'
I would like to define a function that extracts the previous cell value along with the current cell value. I wrote the following code to do so:
t = x{1,i} - Current Cell Value
f = x{2,i-1} - Previous Cell Value, starting with Cell 2 with the previous value of Cell 1
But I keep getting the error
Index in position 2 is invalid. Array indices must be positive integers or logical values.
I believe the error is with regards to the defined function f. It has to do with the i-1 value. At this point, I am stuck. Any thoughts on how to fix that so it works?
Jeffrey Panghttps://fr.mathworks.com/matlabcentral/profile/authors/14936261-jeffrey-pangtag:fr.mathworks.com,2005:Question/4576402019-04-21T09:39:21Z2019-04-21T09:39:21Zhow can I save the real time values in Workspace?Can someone explain and help me? How can I save and update the value of EyePositions from workspace into excel?
Below is the code I had tried...But it only can save the initial value of eyepositions.
% Hough Transform
[centers, radii, metric] = imfindcircles(eyesImage,[floor(r-r/4) floor(r+r/4)],'Method','PhaseCode','ObjectPolarity','dark', 'Sensitivity', 0.95);
[M,I] = sort(radii, 'descend');
eyesPositions = centers;
% Displays full image in gray with Eye detection
subplot(2,2,2);
subimage(eyesImage);
hold on;
title('Eye Image');
%draw all the region that eye pupil
viscircles(centers, radii,'EdgeColor','b','Linestyle','--');
if ~isempty(centers)
disF=(centers(1));
disL=abs(0-disF); %distance from left edge to center point
disR=abs(bboxeyes(1,3)-disF);%distance from right edge to center point
subplot(2,2,4);
title('Direction');
if disL>disR+12 && disL>disR
subimage(right);
else if disR>disL && disR>disL-12
subimage(left);
else
subimage(straight);
end
end
filename = 'testdata.xlsx';
Results_Values=[centers];
Row_Num =1;
xlswrite(filename,centers,'Sheet1',['A' num2str(Row_Num)]);
winopen('testdata.xlsx');
end
end
else
subplot(2,2,4);
subimage(noface);
endchajhttps://fr.mathworks.com/matlabcentral/profile/authors/14268499-chajtag:fr.mathworks.com,2005:Question/4566162019-04-16T05:01:41Z2019-04-21T09:18:40Zhow to average data /6 rows ?how to average data /6 rows ?
my data is
10
'10.2'
'10.8'
'10.6'
10.2'
'10.4'
'10.4'
'11.2'
'11.2'
suryahttps://fr.mathworks.com/matlabcentral/profile/authors/15284587-suryatag:fr.mathworks.com,2005:Question/4576382019-04-21T09:18:32Z2019-04-21T09:18:32Z4D Visualization of a 3D Label MatrixI have a 3D label matrix. I want to visulaise the labels in color in a 3D figure. In order to convert the labels into color I have used label2rgb3d function (available: https://au.mathworks.com/matlabcentral/fileexchange/8355-label2rgb3d). The output from this function is a 4D matirx. Can anyone guide me to get a 3D color plot of the label matrix.Ashane Fernandohttps://fr.mathworks.com/matlabcentral/profile/authors/9500062-ashane-fernandotag:fr.mathworks.com,2005:Question/2930062016-06-29T14:55:05Z2019-04-21T09:17:14Zhow to use dir in subfolders?I am trying to search for all the xlsx files inside a folder that have many subfolders to search from. I realize matlab does not search inside subfolders. So I tried this:
>> addpath(genpath('D:/'))
>> savepath
>> dir *.xlsx
but it is not working, please advice on what I can do. I want to make a code that works for any folder that I put inside genpath(' '). Thanks!chlor thankshttps://fr.mathworks.com/matlabcentral/profile/authors/8383523-chlor-thankstag:fr.mathworks.com,2005:Question/4576372019-04-21T09:16:31Z2019-04-21T09:16:31ZConnection Error for Simulink OnrampI was trying to launch simulink onramp on MATLAB R2019a .But, it is showing the following error
Error code: -130
Error message: ERR_PROXY_CONNECTION_FAILED
Do note it that i am not using a proxy server. Can anyone help me out with this,please.
Thank you
Jamaluddin Khanhttps://fr.mathworks.com/matlabcentral/profile/authors/14852973-jamaluddin-khantag:fr.mathworks.com,2005:Question/4012042018-05-17T11:45:03Z2019-04-21T09:16:24ZHow do I read Folders with subfolders ?I have a folder named "Yale" with subfolder named "YaleB01" to "YaleB21" in MATLAB directory. Each subfolder contains images. How can I read all of them ("YaleB01" to "YaleB21") & show them in different windows i.e. X number of windows for Y number of images. I am new to MATLAB & need your guide. Can somebody help me on this?Chidiebere Ikehttps://fr.mathworks.com/matlabcentral/profile/authors/10712487-chidiebere-ike