https://fr.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-09-20T08:33:36Ztag:fr.mathworks.com,2005:Question/4809772019-09-18T14:42:19Z2019-09-20T08:32:50ZError in fitting two parameters with lsqnonlinI want to fit two parameters using lsqnonlin. I have set up my system of ODE and want to solve them with my new parameters that are found after I performed the lsqnonlin.
I think the problem has to do with the fact that my parameters are in parameter struct par and that I don't want to fit on all of these parameters, but just on basis of two of those.
This is my main script for performing the curve fitting % initial guesses for model parameters, no. of indeces is number of fitted % parameters k0 = [0.028 0.002];
Note that I want to fit for par.kb and par.kf
The error I get is:
I know my initial guesses are close enough. Does anyone know what my problem is?
Cynthia Struijkhttps://fr.mathworks.com/matlabcentral/profile/authors/15345230-cynthia-struijktag:fr.mathworks.com,2005:Question/4812642019-09-20T03:47:05Z2019-09-20T08:29:33ZWhen will the E3xx ipcore generation be avaliable?When will the E3xx ipcore generation be avaliable?
Cause I see that the block E310 will be removed in the future? Is there a clear plan?hao lihttps://fr.mathworks.com/matlabcentral/profile/authors/14890834-hao-litag:fr.mathworks.com,2005:Question/4811622019-09-19T13:08:42Z2019-09-20T08:27:41ZHow to calculate averaged values from 5-min interval valuesHello guys.
I have the following question : I have observations for temperature in 5-minute interval, from 1/1/2015 to 31/1/2015 (8928 rows in total). From these data I must extract the hourly average value for temperature, which means that eventually I must have 24 hourly averaged values.
I would appreciate any ideas on the matter!
PS. I have attached the excel file I'm working on. Please note that the format of time appears diferently on Matlab.
Daphne PARLIARIhttps://fr.mathworks.com/matlabcentral/profile/authors/16289899-daphne-parliaritag:fr.mathworks.com,2005:Question/4811842019-09-19T14:33:54Z2019-09-20T08:27:22ZCreating structure array using for loopHi everyone,
So I'm having some trouble populating a structure array. I found a very helpful tdms file converter on the file exchange that when I run for a data set, gives me a 1x1 structure. I have 1000 different data sets which I woud like to populate into a structure that is 1x1000. All data sets are the same size. I have done something very similare to this before but for a reason beyond me, I cannot get this to work. I have the script I am using below, any help would be much appreciated.
Num = 1000; %number of repeats
for i = 1:1000;
s3_data(i) = TDMS_getStruct(['20190919_s3_test_',num2str(i),'.tdms']);
end
The error I am recieving is as follows:
Subscripted assignment between dissimilar structures.
Error in Process_time_dependet (line 4)
s3_data(i) =
TDMS_getStruct(['20190919_s3_test_',num2str(i),'.tdms']);William Grayhttps://fr.mathworks.com/matlabcentral/profile/authors/14003004-william-graytag:fr.mathworks.com,2005:Question/4812832019-09-20T07:34:19Z2019-09-20T08:23:25ZElements in a vectorHi guys, I need your help.
I have a vector like the following:
rho = [0.8 : -0.01 : -0.8];
The problem is: for every simulation matlab should take in consideration the value of the vector; basically, for the first simulation should take rho = 0.8, for the second rho = 0.79 and so on.
I don't know what function is able to do something like that.
Moreover, I would like to create at the end of each simulation a folder called as the parameter and the value taken into consideration in that simulation (simulation 1, rho= 0.8, foldername rho_0.8); I've tried with the nextname function but I'm not able to use it in this situation.
Thanks in advance for any help.Giuseppe Pintorihttps://fr.mathworks.com/matlabcentral/profile/authors/11452821-giuseppe-pintoritag:fr.mathworks.com,2005:Question/4803502019-09-14T06:41:18Z2019-09-20T08:20:57Zconvert multiple matlab file to separate csv file?I have M1,M2,M3,M4,M5.....upto M16 files which is .mat file....i have to convert it into separate csv files of M1,M2.....upto M16.RAVIhttps://fr.mathworks.com/matlabcentral/profile/authors/12180161-ravitag:fr.mathworks.com,2005:Question/4812842019-09-20T07:39:33Z2019-09-20T08:14:31ZMATLAB Coder: Undefined function or Variable, the first assignment to a local variable determines its classHi,
I am using MATLAB Coder to convert a simple FSK Modem to C Code. Following are my codes:
Modulator Function:
function modSignal = my4FSKmod(data)
M = 4;
freqSep = 200;
fskMod = comm.FSKModulator(M,freqSep,'BitInput',1);
modSignal = step(fskMod,data);
end
Demodulator Function:
function demodData = my4FSKdemod(receivedSignal)
M = 4;
freqSep = 200;
fskDemod = comm.FSKDemodulator(M,freqSep,'BitOutput',1);
demodData = zeros(100,1);
demodData = step(fskDemod,receivedSignal);
end
My Test Code:
data = randi([0 1],100,1);
mod_out = my4FSKmod(data);
demod_out = my4FSKdemod(mod_out);
isequal(data,demod_out);
I went through few MATLAB Answer links and introduced the intialization of the 'demodData', but I still get this issue. Am I missing anything? kindly advicemounikahttps://fr.mathworks.com/matlabcentral/profile/authors/4711487-mounikatag:fr.mathworks.com,2005:Question/4812352019-09-19T20:27:46Z2019-09-20T08:10:29ZHow to change the colors of multiple plots in GUI Hi, I am trying to build a GUI which reads multiple colums of datas from excell files then chooses one by one each column, reads data, plots it, then fits the custom fitting function, and finally plots whole graphs on the same graph after repeating the procedure for different data sets. My GUI can do all these and can plot the different lines all together on the same graph, but all of their colors are the same!..I am not able to use a loop of plottings because I repeat all process after I finish plotting, so in each round I can only plot one graph. Then I used "hold on" to plot them on the same graph.
I may save whole plotted datas in a matrix then use all these datas in the matrix and plot them alltogether, but this road seems too much and unnecessary to me, there must be a short way to achieve it. I could not find an easy way to change the color of each plotting. I am attaching the final picture of the GUI plotting. I can not label them automatically or change the colors of each line automatically :/...
Thanks all your advice..
gulsen kosogluhttps://fr.mathworks.com/matlabcentral/profile/authors/5154392-gulsen-kosoglutag:fr.mathworks.com,2005:Question/4807562019-09-17T10:42:54Z2019-09-20T08:10:09ZHow to find the item order number in List Box in App designer?I have a List box named "Numbers" that has the same 4 items, they all are the number 5. How can I pick the Item3 (The third in order) to change it to 3.
I used [~,idx] = ismember(app.NumbersListBox.Value,app.NumbersListBox.Items);
But I alwyas get to change the first on because the Value are the same.
How can I find inx using "Item number" instead of "Value" ?
Thank you so much Faez Alkadihttps://fr.mathworks.com/matlabcentral/profile/authors/3644876-faez-alkaditag:fr.mathworks.com,2005:Question/4812802019-09-20T07:12:00Z2019-09-20T08:06:20ZCalculating jacobian while using symbolic toolboxHello! I can't seem to find the answer to my problem so I figured that I'd ask it myself.
I am trying to calculate the jacobian based on symbolic variables as follows:
syms x(t) y(t) z(t) theta(t) phi(t) L
q = [x, y, z, theta, phi].';
dq = diff(q,t);
p1 = [x, y, z].';
dp1 = diff(p1, t);
p2 = [x + L*cos(theta),
y + L*cos(phi),
z + L*sin(theta) + L*sin(phi)];
dp2 = jacobian(p2, q)*dq;
I want to use it to module a system using Lagrange modelling.
The error message comes as follow:
Error using sym/jacobian (line 44)
Second argument must be a vector of variables.
Error in untitled (line 15)
dp2 = jacobian(p2, q)*dq;
Thanks in advance, JakobJakob Vinkåshttps://fr.mathworks.com/matlabcentral/profile/authors/9115231-jakob-vinkastag:fr.mathworks.com,2005:Question/2258402015-06-30T01:35:00Z2019-09-20T08:04:05ZHovering mouse over a variable no longer shows present value in R2015a (student) upgrade?I loved the ability to hover my mouse over a vaiable created in a script to show the present value in R2014a (student). Now, since updating to R2015a (student), the hover no longer works. At the moment, BOTH R2014a and R2015a are installed on the same PC. In R2014a, the hover still works. Is there any setting I could have missed?Richardhttps://fr.mathworks.com/matlabcentral/profile/authors/1704021-richardtag:fr.mathworks.com,2005:Question/4811782019-09-19T14:15:26Z2019-09-20T08:00:57Zreading a single image on matlab [filename,pathname]=uigetfile('*.jpg','Select the image');
B= imread(fullfile(pathname,filename), 'jpg');
figure(1);
imshow(B);
---------------------------------------------------------------------------------------------------
B = imread(sprintf('/Users/aylin/Desktop/plants ', k)); // my mistake is in here. how can i solve it? (on macOS)
B = imresize(B,[1000,260]);
[I3,RGB] = createMask(B);
seg_img = RGB;
img = rgb2gray(seg_img);
glcms = graycomatrix(img);
---------------------------------------------------------------------------------------------------
so which version i should use? i am trying to read images from a folder. i select one of the images and then my codes are analysing them.This parts giving error.. aylin yilmazhttps://fr.mathworks.com/matlabcentral/profile/authors/16198336-aylin-yilmaztag:fr.mathworks.com,2005:Question/3953562018-04-16T22:09:14Z2019-09-20T08:00:45Zsingle precision data for griddata()Hi
when I use griddata(x,y,v, xq,yq), x,y,v,xq,yq are all single-precision data to save the memory. but there is an error saying " the input points must be a double array.
However when I checked the online manual for griddata(). it says x,y,z, can be single or double
https://www.mathworks.com/help/matlab/ref/griddata.html
So I am wondering how I can use single-precision data in griddata()?
ThanksYongnuan Liuhttps://fr.mathworks.com/matlabcentral/profile/authors/11447515-yongnuan-liutag:fr.mathworks.com,2005:Question/4812782019-09-20T06:55:56Z2019-09-20T07:57:14ZHow do I get my license and activation keyI have created my account but I can’t get my license and activation key. How do I get them?John Opokuhttps://fr.mathworks.com/matlabcentral/profile/authors/16300428-john-opokutag:fr.mathworks.com,2005:Question/4812812019-09-20T07:21:57Z2019-09-20T07:54:19ZReplacing table cell elements based on values of other table elementsThere is a call-array table such as:
type node rank
____ ________ ____
'abc' '3 0' ','
'acd' '0 3' ','
'bcd' '0 3' ','
'aaa' '3 2' ','
'abb' '4 2' ','
'baa' '4 0' ','
'ccc' '0 2' ','
'caa' '2 1' ','
'cdd' '0 1' ','
'csd' '1 0' ','
'css' '3 1' ','
'bff' '0' ','
'gre' '2 2' ','
'hhh' '3' ','
'qwe' '1' ','
'pin' '3' '1'
'pin' '2' '2'
'pin' '4' '3'
'pin' '1' '4'
The size of table.node{1} is 1x3 cell array. It is not a 1x2 array.
I need to change non zero node values based the rank of their corresponding pin (listed in the last rows of the table). In other words, I need something similar to:
For any non-zero table.node cell element, find the corresponding index of table.type==pin and change the table.node cell element with table.rank{index}
The table should become:
type node rank
____ ________ ____
'abc' '1 0' ','
'acd' '0 1' ','
'bcd' '0 1' ','
'aaa' '1 2' ','
'abb' '3 2' ','
'baa' '3 0' ','
'ccc' '0 2' ','
'caa' '2 4' ','
'cdd' '0 4' ','
'csd' '4 0' ','
'css' '1 4' ','
'bff' '0' ','
'gre' '2 2' ','
'hhh' '1' ','
'qwe' '4' ','
'pin' '1' '1'
'pin' '2' '2'
'pin' '3' '3'
'pin' '4' '4'
What is the shortest command to do this?S Hhttps://fr.mathworks.com/matlabcentral/profile/authors/6229522-s-htag:fr.mathworks.com,2005:Question/4812852019-09-20T07:53:11Z2019-09-20T07:53:11Zhow does 'DataAugmentation' option in pixelLabelImageDatastore work?Hello,
I don't understand how 'pixelLabelDatastore' works when training a U-net using augmented data. I know that the code is the following:
ds = pixelLabelImageSource(imds,pxds,'DataAugmentation',imageAugmenter);
net = trainNetwork(ds,lgraph,options);
Is the U-net trained now using augmented data, or are the augmented images used only when calculating the loss in the mini-batches (and not for training)?
Thanks in advance for any answer!
Marco Festugatohttps://fr.mathworks.com/matlabcentral/profile/authors/12854775-marco-festugatotag:fr.mathworks.com,2005:Question/4810682019-09-19T01:24:54Z2019-09-20T07:51:39ZSaving all outputs of for for-loopI have this code saved in an .m file
function yout=euler1(t0,y0,tfinal,h,f)
y=y0;
for n=t0:0.01:tfinal-h;
y=y+(h.*f(n,y));
end
yout=y
end
and need to save all of the outputs in order to be able to graph it.
How could i modify it in order to save all the outputs at each step/loop to be able to graph it.Andre Metzgerhttps://fr.mathworks.com/matlabcentral/profile/authors/16204308-andre-metzgertag:fr.mathworks.com,2005:Question/3609272017-10-12T08:23:34Z2019-09-20T07:48:38Zfeatures extraction from medical imageHi every one
I need Matlab program for extracting features from medical image
regards,
MajidMajid Al-Sirafihttps://fr.mathworks.com/matlabcentral/profile/authors/3266642-majid-al-sirafitag:fr.mathworks.com,2005:Question/4812602019-09-20T02:56:44Z2019-09-20T07:43:30ZUnderstanding the Behavior of interp2 and interp3I'm finding that the behavior of interp2 and interp3 is counterintuitive, and I'd like to understand how properly to use them. Here's a simple example using interp2:
XX_grid = linspace(eps,10,10);
YY_grid = linspace(eps,50,10);
[XX,YY] = meshgrid(XX_grid,YY_grid);
V = rand(10,10);
x_i = 4; y_i = 9;
interp2(XX_grid,YY_grid,V,XX_grid(x_i),YY_grid(y_i)) % (a)
interp2(YY_grid,XX_grid,V,YY_grid(y_i),XX_grid(x_i)) % (b)
V(x_i,y_i)
I setup two interpolations, (a) and (b). To test the code, I call the interpolations at two points exactly on the grid, which should exactly match the value in the interpolated matrix, V. However, (a) does not match the value from V, while (b) does. (a) is the original way I'd setup the interpolation but it didn't work, and by experimenting, I found that reversing the order of X and Y in (b) does the trick.
I tried the same thing with interp3 and, again, the code doesn't work as I expect. However, because we're in 3D space now, it isn't valid to simply change the order of the grids (and Matlab rightfully throws an error). Can someone shed some light on how I can get this to work?
X_grid = linspace(eps,5,10);
Y_grid = linspace(eps,7,10);
Z_grid = linspace(eps,3,10);
[X,Y,Z] = meshgrid(X_grid,Y_grid,Z_grid);
V = rand(10,10,10);
x_i = 3; y_i = 10; z_i = 5;
interp3(X,Y,Z,V,X_grid(x_i),Y_grid(y_i),Z_grid(z_i))
V(x_i,y_i,z_i)
Thanks for any and all help!Michael Boutroshttps://fr.mathworks.com/matlabcentral/profile/authors/8489353-michael-boutrostag:fr.mathworks.com,2005:Question/4807772019-09-17T13:46:30Z2019-09-20T07:43:25ZHow to Add selected values of Listbox in MATLAB GUI?function listbox1_Callback(hObject, eventdata, handles)
contents= cellstr(get(hObject,'String'));
listchoice=contents(get(hObject,'Value'));
if(strcmp(listchoice,'a'))
lis1=10;
elseif(strcmp(listchoice,'b'))
lis1=20;
elseif(strcmp(listchoice,'c'))
lis1=30;
elseif(strcmp(listchoice,'d'))
lis1=40;
elseif(strcmp(listchoice,'e'))
lis1=50;
end
assignin('base','lis1',lis1);
i have created a listbox with five options with their respected values and when i select more than 1 option , I want the result to be added in the respective listbox.ANURAG DEEPAKhttps://fr.mathworks.com/matlabcentral/profile/authors/15510634-anurag-deepaktag:fr.mathworks.com,2005:Question/4803612019-09-14T10:32:20Z2019-09-20T08:33:36ZWhy does matlab give me the wrong answer?why?
Linus Heierhoffhttps://fr.mathworks.com/matlabcentral/profile/authors/16231081-linus-heierhofftag:fr.mathworks.com,2005:Question/4795332019-09-09T11:07:01Z2019-09-20T07:20:20Zfrequency domain equation for curve fittingHello All,
Is there any equation frequency based for exponential decaying cosine signals to fit on measure data for optimization or curve fitting method?
Thank youIll chhttps://fr.mathworks.com/matlabcentral/profile/authors/16118453-ill-chtag:fr.mathworks.com,2005:Question/4812202019-09-19T18:01:11Z2019-09-20T07:18:41ZA number contain in a series.I have a series 's'
s=(1:1,2:end)
I find its subsequences like
a=s(1:30)
b=s(30:60)
c=s(60:90)
d=s(90:120)
e=s(120:150)
f=s(150:180)
j=s(180:210)
h=s(210:250)
and I have a set of points 'k'.
I need to check any of the subsequence contain any points of the K.If it contain I need to add those subsequence into a variable 'A'.How can I do this.Please help me.Silpa Khttps://fr.mathworks.com/matlabcentral/profile/authors/15760628-silpa-ktag:fr.mathworks.com,2005:Question/4812402019-09-19T21:27:46Z2019-09-20T07:14:12ZFill gaps using Nan in for loopI have a time series with some gaps in it and i want to fill the gaps with NaN in loop.
For example, my data is
data = [0 50;
1 100;
2 200;
3 300;
5 500;
6 600;
7 700;
10 1000;
0 30;
2 20;
6 40]
First column and second column refer to time and signal value. But it has 2 objects. (I have thousands objects.). One was begun from 0(first row), the other one was begun 0(9th row). But sometimes it began from 2 or whatever. The solution code should detect the next result when the value of 1st column decreased.
I'd like to change it as a new_data.
new_data = [1 100;
2 200;
3 300;
4 NaN;
5 500;
6 600;
7 700;
8 NaN;
9 NaN;
10 1000;
0 30;
1 NaN;
2 20;
3 NaN;
4 Nan;
5 Nan;
6 40]
How can I make it?
If anyone can help, it would be greatly appreciated.
Thank you!Jaehwi Bonghttps://fr.mathworks.com/matlabcentral/profile/authors/15010159-jaehwi-bongtag:fr.mathworks.com,2005:Question/4799412019-09-11T15:13:43Z2019-09-20T07:09:59ZCluster of precipitation time seriesHi guys,
I have a precipitation time series of several years and I would like to cluster the information automatically by seasons (Autumn, Winter, Spring, Summer). Using the kmeans algorithm (kmeans(X,4)), I only get the whole domain of the data (i.e. all the years) split in 4 equally spaced subdomains. However, I would like to split each year contained in the whole dataset in the four seasons.
Any ideas from your side?
RCJhttps://fr.mathworks.com/matlabcentral/profile/authors/15165447-cjtag:fr.mathworks.com,2005:Question/4812312019-09-19T19:20:04Z2019-09-20T07:08:04ZDisable windowkeypressfcn when specific child is on focus (app designer)Is there a way to disable windowkeypressfcn when a specific child is on focus
For example,
I have a slider and an edit box and created a windowkeypressfcn to allow me to change the slider value by pressing left and rightarrow button.
I want the slider stay in place while user is adding input into the editbox.
Any ideas?
JIAYING WUhttps://fr.mathworks.com/matlabcentral/profile/authors/8155277-jiaying-wutag:fr.mathworks.com,2005:Question/4812612019-09-20T03:04:33Z2019-09-20T06:57:44ZDicominfo tag is being read as uint16 instead of float double Hello,
I am trying to read a private dicom tag using the dicominfo commat.
Following the instructions in MathWorks site:
(a) Genrated a unique dicom dictionary, where I added this tag <using the format: [Tag] [Name] FL (float double) 4>
(b) set the code to use this dictionary when reading the dicominfo <using the dicomdict('set',....) command>
Now, When I am running the code I see that the dicominfo is using the new dictionary (Tag name is according to the dictionary setup), yet the tag value is still being imported as unit16 and not float double.
Any ideas that can help to solve this one?ErLanhttps://fr.mathworks.com/matlabcentral/profile/authors/16298536-erlantag:fr.mathworks.com,2005:Question/4812772019-09-20T06:55:02Z2019-09-20T06:56:09ZIntegration output is NaNI don't understand why my double integration is resulting in NaN.
%Author: Amit Patel
%Prob. of non eavesdropping event
clc;
clear all;
%close all;
%-----------------------------------
neta=0.75; %Energy harvesting efficiency
rho=0.5; %PSR parameter
T=1e-3;
%-----------------------------------
sigma_sq=1;
%-----------------------------------
Eb=(1:10:1000)*1e-3;
Eb_end=size(Eb);
in=Eb_end(1,2);
P=10.^(15./10);
d0=2;
m=3;
var_hsd=(d0^(-m));
d1=3;
m=3;
var_hse=(d1^(-m));
d2=3;
m=3;
var_hed=(d2^(-m));
Rs=2;
SNRth=2^Rs;
count=0;
g3=10^(-5); %-30dB
%g3=0;
%------------------------------------
lambda_0=1/(var_hsd);
lambda_1=1/(var_hse);
lambda_2=1/(var_hed);
gammath=2^Rs;
Ravg_ana=[];
R_avg1=0;
for i=1:in
a=(1-rho).*neta.*rho.*P.*g3./(1-neta.*rho.*g3);
b=(1-rho).*Eb(i).*g3./((1-neta.*rho.*g3).*T) + sigma_sq;
fun=@(x,z) log2(1+x).*(lambda_1.*lambda_0.*(1-neta.*rho.*g3)./(P.*neta.*rho.*P.*z)).*exp(-lambda_1.*b.*x.*sigma_sq./(P.*(1-rho) -a.*x) ).*exp(-lambda_0.*x.*Eb(i).*z./((1-neta.*rho.*g3).*T.*P)).*exp(-lambda_0.*x.*sigma_sq./P).*( Eb(i).*z./((1-neta.*rho.*g3).*T)+sigma_sq + 1./( (lambda_0.*x./P) +lambda_1.*(1-neta.*rho.*g3)./(neta.*rho.*P.*z) ) )./((lambda_0.*x./P) +lambda_1.*(1-neta.*rho.*g3)./(neta.*rho.*P.*z)).*lambda_2.*exp(-lambda_2.*z);
R_avg= integral2(fun,0,Inf,0,Inf);
Ravg_ana=[Ravg_ana R_avg]
count=count+1
end;
plot(Eb,Ravg_ana,'b-');
hold on;
xlabel('Eb');
ylabel('Average Eavesdropping rate');
grid on;
Amit Patelhttps://fr.mathworks.com/matlabcentral/profile/authors/7559603-amit-pateltag:fr.mathworks.com,2005:Question/293872012-02-17T03:48:03Z2019-09-20T06:55:33ZDepth feature extraction from a 2D ImageI want to measure the Percentage(%)of waste in a waste bin by processing an image of waste bin. If I can measure the waste upper surface co-ordinate with respect to the waste bin container's top circumference then I can calculate the percentage of waste filling in the container. So how do I can measure the co-ordinate from an 2D Image in Matlab or any other software? Please help me..or please share your idea that may help to find the desired results.
Regards
ShafiqulSHAFIQULhttps://fr.mathworks.com/matlabcentral/profile/authors/1323405-shafiqultag:fr.mathworks.com,2005:Question/4812742019-09-20T05:42:12Z2019-09-20T06:51:28ZHow to horizontally align multiple lines ylabel
how to put [A], [V] and [P.U.] at the center.
I have used:
set(ylb1, 'Position', [yl_pos, 0, 0],'rotation',0,'VerticalAlignment','middle','HorizontalAlignment','center' );
but it cannot align the text inside, can just align the position of the ylabel.qaqcvchttps://fr.mathworks.com/matlabcentral/profile/authors/11255036-qaqcvctag:fr.mathworks.com,2005:Question/4800802019-09-12T12:54:58Z2019-09-20T06:43:41ZUplink communcation Channel Winner 2Hello, I'm trying to create a Uplink communication between a MS and a BS with the channel winner 2, does anyone have a code examples on this ?
How can I implement a MS and BS code level?
Thank you
Stefano Della Beffahttps://fr.mathworks.com/matlabcentral/profile/authors/15426458-stefano-della-beffatag:fr.mathworks.com,2005:Question/4806172019-09-16T14:47:38Z2019-09-20T06:36:10ZGet STFT plot with matrix InputHello,
I am working with a radar output Q/ I matrix and I want to apply stft on the complex matrix (I + j Q) using matlab.
The stft function didn't accept Matrix Input. Is there a way to do it ?
Thank you so much in advance :) Nourhttps://fr.mathworks.com/matlabcentral/profile/authors/15483409-nourtag:fr.mathworks.com,2005:Question/4805942019-09-16T12:05:03Z2019-09-20T06:20:41ZHow to make two numeric field related in GUI?It is the first time for me to use MATLAB GUI and I am trying to make a relation between two numeric field componets, so that if I put a number in the first numeric field and press "Enter", a specific value will be shown in the other numeric field according to an equation that I have.
Could someone please help me to do this?Mohamed Elasmarhttps://fr.mathworks.com/matlabcentral/profile/authors/13007075-mohamed-elasmartag:fr.mathworks.com,2005:Question/926342013-01-03T19:04:00Z2019-09-20T06:18:10ZWhy do I get a connection error when installing or activating MATLAB or another MathWorks product?I get an error that I cannot connect to MathWorks when running the MATLAB installer or the activation client. However, I can access the website. Why can't the activation client connect to the MathWorks?
Connection Error
The application could not connect to MathWorks.
For more information on resolving this issue, see this Support Article.
MathWorks Support Teamhttps://fr.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:fr.mathworks.com,2005:Question/4798572019-09-11T08:09:56Z2019-09-20T06:14:29ZDifferences between Deep Learning Toolboxes versions 18b and 19aI have successfully set up a GoogLeNet network using the Deep Learning Toolbox (version 19a) on a standalone computer. I copied the LayerGraph variable to my networked computer which runs version 18b. When I load the variable I get the following warnings and the LayerGraph variable is empty:
Warning: While loading an object of class 'nnet.cnn.layer.ImageInputLayer':
Reference to non-existent field 'IsAverageImageMeanPerChannel'.
Warning: While loading an object of class 'nnet.cnn.layer.FullyConnectedLayer':
Index exceeds the number of array elements (1).
Warning: While loading an object of class 'nnet.cnn.LayerGraph':
Dot indexing is not supported for variables of this type.
I have read the release notes for the Deep Learning Toolbox version 19a, and cannot see why it should not be backward compatible (although I admit that I did not fully understand all the comments).
Am I trying to do something that is impossible, or have I overlooked something?
Nick Granvillehttps://fr.mathworks.com/matlabcentral/profile/authors/10906486-nick-granvilletag:fr.mathworks.com,2005:Question/4812752019-09-20T06:03:40Z2019-09-20T06:03:40ZSignal Processing Align Errorcode : -
%determining the leg and allinging the signals
del=finddelay(fout1,fout2);
if (del>0)
fout1=alignsignals(fout1,fout2);
else
fout2=alignsignals(fout2,fout1);
end
Error : -
Error in stage1 (line 49)
fout2=alignsignals(fout2,fout1);
Sai Sandeep Rayanuthalahttps://fr.mathworks.com/matlabcentral/profile/authors/13349044-sai-sandeep-rayanuthalatag:fr.mathworks.com,2005:Question/634602013-02-14T13:16:40Z2019-09-20T06:00:31ZHow to perform a lexicographical sorting of matricesHi people, i'm new to this MATLAB and as of now i'm currently working copy-move forgery detection. I've stored my matrices into a multidimensional array but i'm quite clueless as to how do i go about sorting it. Below is a testing code which im playing around with:
a=[1 2 3 4 5;6 7 8 9 1;1 2 3 4 5;6 7 4 2 6;2 3 8 9 1]
k = zeros([2, 2, 16], class(a));
currSliceNo = 0;
for i=1:4
for j=1:4
currSliceNo = currSliceNo+1;
k(:,:,currSliceNo)=(a(i:i+1,j:j+1));
end
end
k
Where k is my multidimensional array which i would like to do a lexicographical sort on. Any help would be appreciated thank you :)Bobhttps://fr.mathworks.com/matlabcentral/profile/authors/4061477-bobtag:fr.mathworks.com,2005:Question/4812492019-09-19T23:52:51Z2019-09-20T05:52:13Z[Create mexfunction from C code] The order of several c filesI have a c source code that consists of several .c files. How can I know the orders of these files when I build the mex function?
for example:
mex mainFun.c X.c Y.c Z.c
This is the source code:
https://github.com/yorak/ACOTSP
I have got this error "Error using mex D:\TestMexFunction\unix_timer.c:22:26: fatal error: sys/resource.h: No such file or directory #include <sys/resource.h> ^
compilation terminated." when I run:
mex mainFun.c ants.c parse.c TSP.c dos_timer.c InOut.c ls.c unix_timer.c utilities.c
mainFun.c includes the mexFunction()
acotsp.c includes the main() function
Is it because of the order of c files or another reason?shdotcom shdotcomhttps://fr.mathworks.com/matlabcentral/profile/authors/7350770-shdotcom-shdotcomtag:fr.mathworks.com,2005:Question/4799252019-09-11T14:06:05Z2019-09-20T05:44:12Zmfilt.firtdecim to dsp.FIRDecimatorI’ve used “mfilt.firtdecim” to generator a fir decimation by 2 cic compensation filter (At least 10 years) that import into Filter Designer app.
Want to set CoeffWordLength, InputWordLength, InputFracLength, OutputWordLength, OutputFracLength, AccumFracLength & OverflowMode.
I’m looking to dsp.FIRDecimator to do the same job but it not clear to me how to do that.
If anybody could point me in the right direction, I would appreciate it.
AlanAlan Jaysonhttps://fr.mathworks.com/matlabcentral/profile/authors/3259405-alan-jaysontag:fr.mathworks.com,2005:Question/4805312019-09-16T02:37:19Z2019-09-20T05:44:09ZHow to crop multiple images?
I need some help for multiple images cropping. I used this code but it showed error and said Computer Image System Toolbox used.
In here i use this code for cropping.
imageDir = 'D:\Masters Thesis\ssss';
ssss = imageSet(imageDir);
for k = 1 : ssss.Count
theImage = imread(ssss);
croppedImage = imcrop(theImage,[646, 1291, 481, 600]);
baseFileName = sprintf('Image #%d.png', k);
fullFileName = fullfile(imageDir, baseFileName);
imwrite(croppedImage, fullFileName);
end
can anyone help me to solve this prolem.
TIA Mohammad Shakhawat Sumonhttps://fr.mathworks.com/matlabcentral/profile/authors/14216035-mohammad-shakhawat-sumontag:fr.mathworks.com,2005:Question/4811512019-09-19T11:58:07Z2019-09-20T05:38:09ZError in plot functionHi I am plotting some results but getting an error in Plot Function. I am using MATLAB 2018b, below is my code
load MCAsLDA
MCAsLDA = table2array(MCAsLDA);
WindowSizes=MCAsLDA(:,1);
Data1Disjoint=MCAsLDA(:,2);
% Data1Disjoint=smooth(Data1Disjoint);
Data1Overlap=MCAsLDA(:,3);
% Data1Overlap=smooth(Data1Overlap);
Data2Disjoint=MCAsLDA(:,4);
% Data2Disjoint=smooth(Data2Disjoint);
Data2Overlap=MCAsLDA(:,5);
% Data2Overlap=smooth(Data2Overlap);
Data3Disjoint=MCAsLDA(:,6);
% Data3Disjoint=smooth(Data3Disjoint);
Data3Overlap=MCAsLDA(:,7);
f1=fit(WindowSizes,Data1Disjoint,'cubicinterp');
f2=fit(WindowSizes,Data2Disjoint,'cubicinterp');
f3=fit(WindowSizes,Data3Disjoint,'cubicinterp');
f4=fit(WindowSizes,Data1Overlap,'cubicinterp');
f5=fit(WindowSizes,Data2Overlap,'cubicinterp');
f6=fit(WindowSizes,Data3Overlap,'cubicinterp');
figure
hold on
p1=plot(f1,WindowSizes,Data1Disjoint,'LineWidth',2);
p2=plot(f2,WindowSizes,Data2Disjoint);
p3=plot(f3,WindowSizes,Data3Disjoint);
p4=plot(f4,WindowSizes,Data1Overlap);
p5=plot(f5,WindowSizes,Data2Overlap);
p6=plot(f6,WindowSizes,Data3Overlap);
grid on
title('Classification accuracy Vs. Window Sizes for LDA')
ylabel('Mean Classification Accuracy')
Hassan Ashrafhttps://fr.mathworks.com/matlabcentral/profile/authors/14991031-hassan-ashraftag:fr.mathworks.com,2005:Question/4809252019-09-18T10:57:48Z2019-09-20T05:35:46ZHow to plots the graphs with multiple y axes with one common x-axis?There i attached a plot. In this plot, with a common x-axis graphs had been plotted with repeatative data. Everytime for a new set data, y-axis is shifted by some fixed distance. This diagram is taken from a research paper (A.A. Ampadu-Mintah and M.F. Tachie, 2015). Please help me how to write a matlab code for these types of plots.
Thank You.kalpana rajpoothttps://fr.mathworks.com/matlabcentral/profile/authors/14351436-kalpana-rajpoottag:fr.mathworks.com,2005:Question/4812692019-09-20T04:32:39Z2019-09-20T05:30:20ZCould anyone help me how to get different cell size.A= [1 2 3 4 5 6;
1 3 2 4 5 6;
1 4 2 3 5 6;
1 5 2 3 4 6;
3 5 1 2 4 6;
1 6 2 3 4 5;
3 6 1 2 4 5;
4 6 1 2 3 5]
NN = num2cell(num2cell(A),2)
when i run the command with respect to the above matrix it gives the fllowing result
NN = {1x6 cell}
{1x6 cell}
{1x6 cell}
{1x6 cell}
{1x6 cell}
{1x6 cell}
{1x6 cell}
{1x6 cell}
could anyone help me how to get the result in the following manner
NN = {1x1 cell}
{1x2 cell}
{1x3 cell}
{1x4 cell}
{1x5 cell}
{1x6 cell}
{1x2 cell}
{1x3cell}
jaah navihttps://fr.mathworks.com/matlabcentral/profile/authors/11695462-jaah-navitag:fr.mathworks.com,2005:Question/4812722019-09-20T05:24:23Z2019-09-20T05:24:23ZOptimizing 'spread' in Matlab's built-in radial basis network functionIn later versions of Matlab, there are functions named newrb and newrbe to design radial basis networks. For both functions, there is an argument called "spread" which is a user-defined constant. It represents the measure of standard deviation of the Gaussian kernel for radial basis function, and all of the neurons will share same "spread" for a given configuration. In most cases, it needs to be optimized by trial and error. However, in my opinion, the network would be able to approximate desired function with much better capability if it could optimize the "spread" itself for each individual neuron (instead of having one shared by all neurons). Is there any way to achieve that using a built-in function or customize pieces of functions that could be stitched together inside these functions (newrb and newrbe)?Shah Bahauddinhttps://fr.mathworks.com/matlabcentral/profile/authors/7385352-shah-bahauddintag:fr.mathworks.com,2005:Question/4808222019-09-17T19:18:49Z2019-09-20T05:20:02ZBlock Error, Singularity in Solution?The error for my sim reads:
Derivative of state '1' in block 'shifter_system_sim_new/Integration 2' at time 0.01322996254791375 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)
I've been trying to resolve this issue for a while and have looked at similar solutions to the same problem but can't figure out what is wrong and how to resolve this error. Will someone please tell me if this error is a sigularity issue or a step size issue? If so, how would I resolve it exactly for it to work?
Files are attached. Michael Sciroccohttps://fr.mathworks.com/matlabcentral/profile/authors/14477174-michael-sciroccotag:fr.mathworks.com,2005:Question/4802612019-09-13T12:21:17Z2019-09-20T05:19:17ZTrajectory input manipulation for Simulink modelHy there,
I would like to simulate a truck following a path, which is defined by multiple point in a fixed xy plane (simplified from GPS coordinates).
Lets assume that i already have a mathematical model, which can calculate steering angle based on the following inputs:
lateral error between a vehicle-based point and the path point (which varies with time)
vehicle orientation error, which is the difference between the truck's heading angle and the path tangential in the specified point
My question is, how could I manipulate the input of the model using the given path informations (points)?
The path can be calculated using pre-defined informations, no need for real time calculation. The truck will follow plantation lines.
So the truck needs to follow a set of points, but the reference point is varying with time, and I don't know how to teach the model to follow a specific point, and how to define which point to follow at a specific time.
I would like to solve this in Simulink.
Sorry for foggy explanation, if something is not clear, please ask.
Thanks for your help in addition.
Gergely HunyadyGergely Hunyadyhttps://fr.mathworks.com/matlabcentral/profile/authors/9926623-gergely-hunyadytag:fr.mathworks.com,2005:Question/1074992013-11-25T18:03:31Z2019-09-20T05:17:15ZHow do I find the heart rate variability if I have ECG data that's been cutoff at a specific threshold.I have a set of raw ECG data that needs analysis. The problem is that when acquiring the data the person in charge made a mistake and set a cutoff threshold cutting of the peaks of the R wave.
I've tried using common heart rate scripts but they tended not to work. I'v also tried implementing a variation of findpeaks but i'v ended up with very wrong results. So what i'v basically tried till now is take the first peak(seeing as the cutoff resulted in forming 2 peaks) and comparing it with the next "first peak". The results are still off though.
Does anyone have a suggestion with regards to how to approach this problem?
Code:
if true
function [ pkLoc, pkAmp, pkDistance, hr ] = peakFinder( input, amplitude, sampRate )
minimumDistance = sampRate*0.2; %Distance is related to sampling rate.
minimumHeight = amplitude*10^-4; %Amplitude in scale.
pkDistance = [];
[ pkAmp, pkLoc] = findpeaks(input, 'minpeakheight', minimumHeight);
for i = 2: length(pkLoc)
if (input(1,pkLoc(1,i)-1) == -inf)
pkLoc(i) = 0;
pkAmp(i) = 0;
end
end
pkLoc(pkLoc == 0) = [];
pkAmp(pkAmp == 0) = [];
for i = 2: length(pkLoc)
pkDistance(i-1) = pkLoc(i-1)- sum(pkDistance);
end
hr = (60*sampRate./pkDistance);
hr = int8(hr);
end
endTalalhttps://fr.mathworks.com/matlabcentral/profile/authors/4399162-talaltag:fr.mathworks.com,2005:Question/4812282019-09-19T18:58:12Z2019-09-20T05:15:59ZRandi command for a matrixi am using a random generator for a matrix.
However the randi command is not working for matrix C with following error (Error using randi First input must be a positive scalar integer value IMAX, or two integer values [IMIN IMAX] with IMIN less than or equal to IMAX.)
clear all
clc
A = (textread('data_mat_ta01_11x5.txt'))'
size(A)
B=A/9
C=floor(B)
D=randi(C)Bilal Khurshidhttps://fr.mathworks.com/matlabcentral/profile/authors/8438142-bilal-khurshidtag:fr.mathworks.com,2005:Question/4812712019-09-20T05:07:24Z2019-09-20T05:09:51Zfind index of a element present in matrixHi...
I have a matrix A= [0 0 1 1; 1 0 0 1; 0 0 0 1]. I want to find the index of the first 1 of a row and want to save in a column matrix Z. In this case Z must be: Z=[ 3; 1; 4]. I am using this command Z = find(A(1,:), 1, 'first') but unable to do for second and third row. Kindly provide necessary codes for solving this.
Thank you.anakhi hazarikahttps://fr.mathworks.com/matlabcentral/profile/authors/4437831-anakhi-hazarikatag:fr.mathworks.com,2005:Question/4812702019-09-20T05:04:57Z2019-09-20T05:04:57Zhello, In a DC-DC boost converter during double-loop control process, CMC (Current mode control) why does the voltage control work better than VMC (voltage mode control) when load changes when the current is introduced as the inner loop feedback ? hello, In a DC-DC boost converter during double-loop control process, CMC (Current mode control) why does the voltage control output come better than VMC (voltage mode control) when load changes when the current is introduced as the inner loop feedback ?
guide me please,
thank youBILAL ANWARhttps://fr.mathworks.com/matlabcentral/profile/authors/14920768-bilal-anwar