Tag Archives: matlab
Unrecognized function or variable ‘mexUnwrap’.
I get this error: “Unrecognized function or variable ‘mexUnwrap’” when I run my code. However, the folder containing this C++ file (mexUnwrap.c) is in my path. It also contains mexUnwrap.mexa64, mexUnwrap.mexmaci64, mexUnwrap.mexw64. Do you have any suggestions for solving this problem?I get this error: “Unrecognized function or variable ‘mexUnwrap’” when I run my code. However, the folder containing this C++ file (mexUnwrap.c) is in my path. It also contains mexUnwrap.mexa64, mexUnwrap.mexmaci64, mexUnwrap.mexw64. Do you have any suggestions for solving this problem? I get this error: “Unrecognized function or variable ‘mexUnwrap’” when I run my code. However, the folder containing this C++ file (mexUnwrap.c) is in my path. It also contains mexUnwrap.mexa64, mexUnwrap.mexmaci64, mexUnwrap.mexw64. Do you have any suggestions for solving this problem? error, unrecognized c++ function MATLAB Answers — New Questions
Warning: Results may be inaccurate because of an ill-conditioned Jacobian whose reciprocal condition number is 2.03573e-39
I’m trying to solve an boundary value problem with eigenvalues, following the article ( https://doi.org/10.1063/5.0155331 )
where and At are certain numbers and Q() is a known function, erf function in this case.
is the unknown function and the eigenvalue.
The boundary condition is , so I specified
For small alphas my code with bvp5c works well.
However for large alphas, my solution deviates from the result in the article, and I’m encountering messages like
Warning: Results may be inaccurate because of an ill-conditioned Jacobian whose reciprocal condition number is 2.03573e-39
I guess the boundary values may be too small and tried to scale my boundary values with C*exp(-3/alpha) but the problem remains.
How can I solve the problem? Fig.1 in https://doi.org/10.1063/5.0155331 can be referred as a correct solution to this problem. My solution looks similar to it but deviates in asymptotic values.
eigenvalues0999 = zeros(1, 30);
global alpha;
global At;
options = bvpset(‘RelTol’,1e-5,’AbsTol’,1e-5);
At = 0.999;
for i=1:30
alpha=1/i;
Psi1 = 1;
solinit = bvpinit(linspace(-3,6,30000),@mat4init,Psi1);
sol = bvp5c(@mat4ode, @mat4bc, solinit,options);
eigenvalues0999(1,i) = sol.parameters;
end
figure(Color="white");
plot(eigenvalues0999);
grid on;
legend(‘0′,’0.243′,’0.5′,’0.843′,’0.999′,’FontSize’, 14)
xlabel(‘alpha^{-1}’,’FontSize’, 14);
ylabel(‘Psi’,’FontSize’, 14);
set(gca, ‘FontSize’, 14);
function dydx = mat4ode(x,y,Psi1) % equation being solved
global alpha;
global At;
dydx = [y(2)
(-alpha^2*At*2/sqrt(pi)*exp(-x.^2)*y(2)+(1+At*erf(x)-alpha*Psi1*2/sqrt(pi)*exp(-x.^2))*y(1))/(alpha^2*(1+At*erf(x)))];
end
function res = mat4bc(ya,yb,Psi1) % boundary conditions
global alpha;
res = [ya(2)-1/alpha*exp(-3/alpha)
abs(yb(1))+abs(yb(2))
%yb(2)
ya(1)-exp(-3/alpha)];
end
function yinit = mat4init(x) % initial guess function
global alpha;
yinit = [exp(-abs(x)/alpha)
-sign(x)*1/alpha*exp(-abs(x)/alpha)];
endI’m trying to solve an boundary value problem with eigenvalues, following the article ( https://doi.org/10.1063/5.0155331 )
where and At are certain numbers and Q() is a known function, erf function in this case.
is the unknown function and the eigenvalue.
The boundary condition is , so I specified
For small alphas my code with bvp5c works well.
However for large alphas, my solution deviates from the result in the article, and I’m encountering messages like
Warning: Results may be inaccurate because of an ill-conditioned Jacobian whose reciprocal condition number is 2.03573e-39
I guess the boundary values may be too small and tried to scale my boundary values with C*exp(-3/alpha) but the problem remains.
How can I solve the problem? Fig.1 in https://doi.org/10.1063/5.0155331 can be referred as a correct solution to this problem. My solution looks similar to it but deviates in asymptotic values.
eigenvalues0999 = zeros(1, 30);
global alpha;
global At;
options = bvpset(‘RelTol’,1e-5,’AbsTol’,1e-5);
At = 0.999;
for i=1:30
alpha=1/i;
Psi1 = 1;
solinit = bvpinit(linspace(-3,6,30000),@mat4init,Psi1);
sol = bvp5c(@mat4ode, @mat4bc, solinit,options);
eigenvalues0999(1,i) = sol.parameters;
end
figure(Color="white");
plot(eigenvalues0999);
grid on;
legend(‘0′,’0.243′,’0.5′,’0.843′,’0.999′,’FontSize’, 14)
xlabel(‘alpha^{-1}’,’FontSize’, 14);
ylabel(‘Psi’,’FontSize’, 14);
set(gca, ‘FontSize’, 14);
function dydx = mat4ode(x,y,Psi1) % equation being solved
global alpha;
global At;
dydx = [y(2)
(-alpha^2*At*2/sqrt(pi)*exp(-x.^2)*y(2)+(1+At*erf(x)-alpha*Psi1*2/sqrt(pi)*exp(-x.^2))*y(1))/(alpha^2*(1+At*erf(x)))];
end
function res = mat4bc(ya,yb,Psi1) % boundary conditions
global alpha;
res = [ya(2)-1/alpha*exp(-3/alpha)
abs(yb(1))+abs(yb(2))
%yb(2)
ya(1)-exp(-3/alpha)];
end
function yinit = mat4init(x) % initial guess function
global alpha;
yinit = [exp(-abs(x)/alpha)
-sign(x)*1/alpha*exp(-abs(x)/alpha)];
end I’m trying to solve an boundary value problem with eigenvalues, following the article ( https://doi.org/10.1063/5.0155331 )
where and At are certain numbers and Q() is a known function, erf function in this case.
is the unknown function and the eigenvalue.
The boundary condition is , so I specified
For small alphas my code with bvp5c works well.
However for large alphas, my solution deviates from the result in the article, and I’m encountering messages like
Warning: Results may be inaccurate because of an ill-conditioned Jacobian whose reciprocal condition number is 2.03573e-39
I guess the boundary values may be too small and tried to scale my boundary values with C*exp(-3/alpha) but the problem remains.
How can I solve the problem? Fig.1 in https://doi.org/10.1063/5.0155331 can be referred as a correct solution to this problem. My solution looks similar to it but deviates in asymptotic values.
eigenvalues0999 = zeros(1, 30);
global alpha;
global At;
options = bvpset(‘RelTol’,1e-5,’AbsTol’,1e-5);
At = 0.999;
for i=1:30
alpha=1/i;
Psi1 = 1;
solinit = bvpinit(linspace(-3,6,30000),@mat4init,Psi1);
sol = bvp5c(@mat4ode, @mat4bc, solinit,options);
eigenvalues0999(1,i) = sol.parameters;
end
figure(Color="white");
plot(eigenvalues0999);
grid on;
legend(‘0′,’0.243′,’0.5′,’0.843′,’0.999′,’FontSize’, 14)
xlabel(‘alpha^{-1}’,’FontSize’, 14);
ylabel(‘Psi’,’FontSize’, 14);
set(gca, ‘FontSize’, 14);
function dydx = mat4ode(x,y,Psi1) % equation being solved
global alpha;
global At;
dydx = [y(2)
(-alpha^2*At*2/sqrt(pi)*exp(-x.^2)*y(2)+(1+At*erf(x)-alpha*Psi1*2/sqrt(pi)*exp(-x.^2))*y(1))/(alpha^2*(1+At*erf(x)))];
end
function res = mat4bc(ya,yb,Psi1) % boundary conditions
global alpha;
res = [ya(2)-1/alpha*exp(-3/alpha)
abs(yb(1))+abs(yb(2))
%yb(2)
ya(1)-exp(-3/alpha)];
end
function yinit = mat4init(x) % initial guess function
global alpha;
yinit = [exp(-abs(x)/alpha)
-sign(x)*1/alpha*exp(-abs(x)/alpha)];
end bvp5c, solve MATLAB Answers — New Questions
I’m curious about the process of creating HDMap binary files in the example ‘Building Scenes from Custom Data Using RoadRunner HD Maps’.
I’m working on a scene-building example from custom data using RoadRunner HD maps.
There’s a problem that hasn’t been solved, so I’m asking
I’m curious about the process of creating HDMap binary files in the example ‘Building Scenes from Custom Data Using RoadRunner HD Maps’.
I would like to know in detail what files apply the c++ code provided in the example, and how to create a loader HDMap binary file from custom data.I’m working on a scene-building example from custom data using RoadRunner HD maps.
There’s a problem that hasn’t been solved, so I’m asking
I’m curious about the process of creating HDMap binary files in the example ‘Building Scenes from Custom Data Using RoadRunner HD Maps’.
I would like to know in detail what files apply the c++ code provided in the example, and how to create a loader HDMap binary file from custom data. I’m working on a scene-building example from custom data using RoadRunner HD maps.
There’s a problem that hasn’t been solved, so I’m asking
I’m curious about the process of creating HDMap binary files in the example ‘Building Scenes from Custom Data Using RoadRunner HD Maps’.
I would like to know in detail what files apply the c++ code provided in the example, and how to create a loader HDMap binary file from custom data. roadrunner, hdmap, binary, c++ MATLAB Answers — New Questions
MATLAB Onramp 14.1 Project- Stellar Motion Task 7
Modify the Task 2 & 7 section of the script so that it performs the red shift calculation on the second star in spectra, not the sixth.
I have changed s to the second column (s= spectra(:,2)), and that is right.
How do I get the correct values of lambdaHa and speed?Modify the Task 2 & 7 section of the script so that it performs the red shift calculation on the second star in spectra, not the sixth.
I have changed s to the second column (s= spectra(:,2)), and that is right.
How do I get the correct values of lambdaHa and speed? Modify the Task 2 & 7 section of the script so that it performs the red shift calculation on the second star in spectra, not the sixth.
I have changed s to the second column (s= spectra(:,2)), and that is right.
How do I get the correct values of lambdaHa and speed? onramp, stellar motion 14.1, inramp, stellar motion MATLAB Answers — New Questions
Importing GeoTIFF results in a rotated image
Hello all,
hopefully a very simple question, with a simple solution:
I would like to import some GeoTIFFs to build my 3D model based on.
But after the import the image looks slightly rotated and no longer parallel to the X and Y axes.
Can someone expain me why?
When I import the same GeoTIFF with the mapping toolbox the result looks like expected:
I assume it has something to do with projection or World Origin. But I can’t identify it.
Thx in advance,
TimHello all,
hopefully a very simple question, with a simple solution:
I would like to import some GeoTIFFs to build my 3D model based on.
But after the import the image looks slightly rotated and no longer parallel to the X and Y axes.
Can someone expain me why?
When I import the same GeoTIFF with the mapping toolbox the result looks like expected:
I assume it has something to do with projection or World Origin. But I can’t identify it.
Thx in advance,
Tim Hello all,
hopefully a very simple question, with a simple solution:
I would like to import some GeoTIFFs to build my 3D model based on.
But after the import the image looks slightly rotated and no longer parallel to the X and Y axes.
Can someone expain me why?
When I import the same GeoTIFF with the mapping toolbox the result looks like expected:
I assume it has something to do with projection or World Origin. But I can’t identify it.
Thx in advance,
Tim geotiff, data import, gis MATLAB Answers — New Questions
When setting the motion input for a prismatic joint to “provided by input,” what format should the input be in?
I set the input for the prismatic joint to ‘provided by input’ in the motion settings, and while I found that the input should include information on position, velocity, and acceleration, I couldn’t find the exact format in which this information should be provided. Could you please let me know the required format?I set the input for the prismatic joint to ‘provided by input’ in the motion settings, and while I found that the input should include information on position, velocity, and acceleration, I couldn’t find the exact format in which this information should be provided. Could you please let me know the required format? I set the input for the prismatic joint to ‘provided by input’ in the motion settings, and while I found that the input should include information on position, velocity, and acceleration, I couldn’t find the exact format in which this information should be provided. Could you please let me know the required format? simulink, simscape MATLAB Answers — New Questions
Problem Plotting Fourier Transforms of Sine waves
Hello!
So let me start off by saying that I barely use MatLab. However, my professor assigned us a homework in which we have to find the fourier transform of a multiplication of sine waves and plot it. This is what I am trying..
>> syms x y
>> f=sin(2*x)*sin(5*x)
f =
sin(2*x)*sin(5*x)
>> g=fourier(f)
g =
2*transform::fourier(cos(x)*sin(x)^6, x, -w) – 20*transform::fourier(cos(x)^3*sin(x)^4, x, -w) + 10*transform::fourier(cos(x)^5*sin(x)^2, x, -w)
>> ezplot(fourier(g))
??? Error using ==> char
Cell elements must be character arrays.
Error in ==> ezplot at 160
fmsg = char(f);
Error in ==> sym.ezplot at 45
h = ezplot(char(f));
Why am I getting this error? How can I plot the Fourier transforms of these sine waves?
Any help would be appreciated!!Hello!
So let me start off by saying that I barely use MatLab. However, my professor assigned us a homework in which we have to find the fourier transform of a multiplication of sine waves and plot it. This is what I am trying..
>> syms x y
>> f=sin(2*x)*sin(5*x)
f =
sin(2*x)*sin(5*x)
>> g=fourier(f)
g =
2*transform::fourier(cos(x)*sin(x)^6, x, -w) – 20*transform::fourier(cos(x)^3*sin(x)^4, x, -w) + 10*transform::fourier(cos(x)^5*sin(x)^2, x, -w)
>> ezplot(fourier(g))
??? Error using ==> char
Cell elements must be character arrays.
Error in ==> ezplot at 160
fmsg = char(f);
Error in ==> sym.ezplot at 45
h = ezplot(char(f));
Why am I getting this error? How can I plot the Fourier transforms of these sine waves?
Any help would be appreciated!! Hello!
So let me start off by saying that I barely use MatLab. However, my professor assigned us a homework in which we have to find the fourier transform of a multiplication of sine waves and plot it. This is what I am trying..
>> syms x y
>> f=sin(2*x)*sin(5*x)
f =
sin(2*x)*sin(5*x)
>> g=fourier(f)
g =
2*transform::fourier(cos(x)*sin(x)^6, x, -w) – 20*transform::fourier(cos(x)^3*sin(x)^4, x, -w) + 10*transform::fourier(cos(x)^5*sin(x)^2, x, -w)
>> ezplot(fourier(g))
??? Error using ==> char
Cell elements must be character arrays.
Error in ==> ezplot at 160
fmsg = char(f);
Error in ==> sym.ezplot at 45
h = ezplot(char(f));
Why am I getting this error? How can I plot the Fourier transforms of these sine waves?
Any help would be appreciated!! fourier, transform, sine, wave, plotting, ezplot MATLAB Answers — New Questions
How can I make a combination/permutation of all possible values with a given subset of data?
Hello, I’m having trouble putting this into words so I’ll give an example and hopefully someone can help.
To make it simple, let’s say I have a 200 second time series (200×1 array) from 3 regions (A,B,C). Each region has different types, so for all A, theres A1, A2, A3 etc. This also applies to B and C. However the number of types differ for each region. So if A has A1 – A5, B would have B1 – B9 etc.
I want to make an array combination of one of each region. So [A1 B1 C1], [A2 B1 C1], [A3 B1 C1], etc. So if I had 3 regions, I want all combinations of a 200 x 3 array possible using one type from each region.
My question is, currently, I have all the types and regions in one array (200 x 164). So A1:A5 B1:B11 C1:C20 D1:D5 etc. In total, I have 54 regions, so I would want to make all possible combinations of a 200 x 54 array.
Is there a way to do this with how my data is currently organized? Thanks for any suggestions.Hello, I’m having trouble putting this into words so I’ll give an example and hopefully someone can help.
To make it simple, let’s say I have a 200 second time series (200×1 array) from 3 regions (A,B,C). Each region has different types, so for all A, theres A1, A2, A3 etc. This also applies to B and C. However the number of types differ for each region. So if A has A1 – A5, B would have B1 – B9 etc.
I want to make an array combination of one of each region. So [A1 B1 C1], [A2 B1 C1], [A3 B1 C1], etc. So if I had 3 regions, I want all combinations of a 200 x 3 array possible using one type from each region.
My question is, currently, I have all the types and regions in one array (200 x 164). So A1:A5 B1:B11 C1:C20 D1:D5 etc. In total, I have 54 regions, so I would want to make all possible combinations of a 200 x 54 array.
Is there a way to do this with how my data is currently organized? Thanks for any suggestions. Hello, I’m having trouble putting this into words so I’ll give an example and hopefully someone can help.
To make it simple, let’s say I have a 200 second time series (200×1 array) from 3 regions (A,B,C). Each region has different types, so for all A, theres A1, A2, A3 etc. This also applies to B and C. However the number of types differ for each region. So if A has A1 – A5, B would have B1 – B9 etc.
I want to make an array combination of one of each region. So [A1 B1 C1], [A2 B1 C1], [A3 B1 C1], etc. So if I had 3 regions, I want all combinations of a 200 x 3 array possible using one type from each region.
My question is, currently, I have all the types and regions in one array (200 x 164). So A1:A5 B1:B11 C1:C20 D1:D5 etc. In total, I have 54 regions, so I would want to make all possible combinations of a 200 x 54 array.
Is there a way to do this with how my data is currently organized? Thanks for any suggestions. combination, permutation, array MATLAB Answers — New Questions
How to retrieve multiband data using shape file?
I have kept the data and shape file on following link
https://drive.google.com/drive/folders/1bnXx0V4V_yfUyWDfKFSxJWlNcWbApuxY?usp=sharing
I am using the code for extracting seven band data as follows;
% Get image info:
DataFile=’C:working_bptbandsBagpat_7Bands.dat’
[Z,R] = readgeoraster(DataFile);
disp(size(Z));
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
ShapeFile=’C:working_bptbandsBAGHPAT.shp’
S = shaperead(ShapeFile);
info = shapeinfo(ShapeFile);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
% Remove trailing nan from shapefile
rx = S(1).lon(1:end-1);
ry = S(1).lat(1:end-1);
logical_mask = inpolygon(S(1).lon,S(1).lat,rx,ry);
% Use the logical mask to extract data
extracted_data = Z(logical_mask);
disp(extracted_data);
it is giving following informations
DataFile =
‘C:working_bptbandsBagpat_7Bands.dat’
5490 5490 7
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(size(extracted_data));
1 9
OR
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(extracted_data);
1794 1842 1829 1858 1934 1968 2315 2635 2578
My target is to retrieve the data from seven band data of dimensions
number of lines = 5490
number of samples = 5490
number of bands =7
and dimensions of output file are supposed to be
number of lines =1153
number of samples = 1315
number of bands =7
I request you to kindly look on it and suggest me how to get seven band data using shape file.I have kept the data and shape file on following link
https://drive.google.com/drive/folders/1bnXx0V4V_yfUyWDfKFSxJWlNcWbApuxY?usp=sharing
I am using the code for extracting seven band data as follows;
% Get image info:
DataFile=’C:working_bptbandsBagpat_7Bands.dat’
[Z,R] = readgeoraster(DataFile);
disp(size(Z));
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
ShapeFile=’C:working_bptbandsBAGHPAT.shp’
S = shaperead(ShapeFile);
info = shapeinfo(ShapeFile);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
% Remove trailing nan from shapefile
rx = S(1).lon(1:end-1);
ry = S(1).lat(1:end-1);
logical_mask = inpolygon(S(1).lon,S(1).lat,rx,ry);
% Use the logical mask to extract data
extracted_data = Z(logical_mask);
disp(extracted_data);
it is giving following informations
DataFile =
‘C:working_bptbandsBagpat_7Bands.dat’
5490 5490 7
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(size(extracted_data));
1 9
OR
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(extracted_data);
1794 1842 1829 1858 1934 1968 2315 2635 2578
My target is to retrieve the data from seven band data of dimensions
number of lines = 5490
number of samples = 5490
number of bands =7
and dimensions of output file are supposed to be
number of lines =1153
number of samples = 1315
number of bands =7
I request you to kindly look on it and suggest me how to get seven band data using shape file. I have kept the data and shape file on following link
https://drive.google.com/drive/folders/1bnXx0V4V_yfUyWDfKFSxJWlNcWbApuxY?usp=sharing
I am using the code for extracting seven band data as follows;
% Get image info:
DataFile=’C:working_bptbandsBagpat_7Bands.dat’
[Z,R] = readgeoraster(DataFile);
disp(size(Z));
p = R.ProjectedCRS;
[x,y] = worldGrid(R);
[lon,lat] = projinv(p,x,y);
ShapeFile=’C:working_bptbandsBAGHPAT.shp’
S = shaperead(ShapeFile);
info = shapeinfo(ShapeFile);
crs = info.CoordinateReferenceSystem;
[S(1).lon,S(1).lat] = projinv(crs,S(1).X,S(1).Y);
% Remove trailing nan from shapefile
rx = S(1).lon(1:end-1);
ry = S(1).lat(1:end-1);
logical_mask = inpolygon(S(1).lon,S(1).lat,rx,ry);
% Use the logical mask to extract data
extracted_data = Z(logical_mask);
disp(extracted_data);
it is giving following informations
DataFile =
‘C:working_bptbandsBagpat_7Bands.dat’
5490 5490 7
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(size(extracted_data));
1 9
OR
ShapeFile =
‘C:working_bptbandsBAGHPAT.shp’
disp(extracted_data);
1794 1842 1829 1858 1934 1968 2315 2635 2578
My target is to retrieve the data from seven band data of dimensions
number of lines = 5490
number of samples = 5490
number of bands =7
and dimensions of output file are supposed to be
number of lines =1153
number of samples = 1315
number of bands =7
I request you to kindly look on it and suggest me how to get seven band data using shape file. how to retrieve multiband data using shape file? MATLAB Answers — New Questions
How do we get the linux device driver files matlab/hdl coder generatwes for the ipcore we made in matlab?
I am working on axi stream interface in zynq workflow which uses a symmetric fir filter IP with AXI stream and AXI4 lite interface to stream data and configure the filter coefficients.The steps i follwed gave me the output, but i wanted to go deeper to understand the backstage where i wanted to see the linux drivers for the ip files, i used terminal emulator ( teraterm to log in to the linux running on the zedboard, i saw the iio structure where my ip and its DMA’s were listed ) and also in the lib directory i saw the drivers too, so my qeustion is how is matlab creating those drivers, i couldnt find the corresponding c files and header files for it looking in the folder created by h dlcoder while running the example.
I did ‘lsmod’ in teraterm and found this :
zynq> lsmod
Module Size Used by Not tainted
mwipcore 3193 0
mwipcore_iio_streaming 9087 1 mwipcore
mwipcore_iio_sharedmem 11368 1 mwipcore
mwipcore_iio_mm 4414 1 mwipcore
mwipcore_dma_streaming 19767 1 mwipcore
mathworks_ip_common 9568 1 mwipcore
xilinx_dma
so my search was to find the c files corresponding to theses driver files that helps me to interface with the ip core created.The below given is how my folder looks like after running the Workflowadvisor.I am working on axi stream interface in zynq workflow which uses a symmetric fir filter IP with AXI stream and AXI4 lite interface to stream data and configure the filter coefficients.The steps i follwed gave me the output, but i wanted to go deeper to understand the backstage where i wanted to see the linux drivers for the ip files, i used terminal emulator ( teraterm to log in to the linux running on the zedboard, i saw the iio structure where my ip and its DMA’s were listed ) and also in the lib directory i saw the drivers too, so my qeustion is how is matlab creating those drivers, i couldnt find the corresponding c files and header files for it looking in the folder created by h dlcoder while running the example.
I did ‘lsmod’ in teraterm and found this :
zynq> lsmod
Module Size Used by Not tainted
mwipcore 3193 0
mwipcore_iio_streaming 9087 1 mwipcore
mwipcore_iio_sharedmem 11368 1 mwipcore
mwipcore_iio_mm 4414 1 mwipcore
mwipcore_dma_streaming 19767 1 mwipcore
mathworks_ip_common 9568 1 mwipcore
xilinx_dma
so my search was to find the c files corresponding to theses driver files that helps me to interface with the ip core created.The below given is how my folder looks like after running the Workflowadvisor. I am working on axi stream interface in zynq workflow which uses a symmetric fir filter IP with AXI stream and AXI4 lite interface to stream data and configure the filter coefficients.The steps i follwed gave me the output, but i wanted to go deeper to understand the backstage where i wanted to see the linux drivers for the ip files, i used terminal emulator ( teraterm to log in to the linux running on the zedboard, i saw the iio structure where my ip and its DMA’s were listed ) and also in the lib directory i saw the drivers too, so my qeustion is how is matlab creating those drivers, i couldnt find the corresponding c files and header files for it looking in the folder created by h dlcoder while running the example.
I did ‘lsmod’ in teraterm and found this :
zynq> lsmod
Module Size Used by Not tainted
mwipcore 3193 0
mwipcore_iio_streaming 9087 1 mwipcore
mwipcore_iio_sharedmem 11368 1 mwipcore
mwipcore_iio_mm 4414 1 mwipcore
mwipcore_dma_streaming 19767 1 mwipcore
mathworks_ip_common 9568 1 mwipcore
xilinx_dma
so my search was to find the c files corresponding to theses driver files that helps me to interface with the ip core created.The below given is how my folder looks like after running the Workflowadvisor. axi stream interface, matlab, hdlcoder MATLAB Answers — New Questions
The word’s font are not consistent.
I use the script to edit chinese, the font of output pdf file is not consistent with orignal script’s font.
orignal script file:
output file(pdf):I use the script to edit chinese, the font of output pdf file is not consistent with orignal script’s font.
orignal script file:
output file(pdf): I use the script to edit chinese, the font of output pdf file is not consistent with orignal script’s font.
orignal script file:
output file(pdf): script, font MATLAB Answers — New Questions
Why am I asked for my account credentials at every startup?
I am using Matlab R2016b on Linux Fedora 24.
Can I permanently set my account credentials so I am not asked at every startup?I am using Matlab R2016b on Linux Fedora 24.
Can I permanently set my account credentials so I am not asked at every startup? I am using Matlab R2016b on Linux Fedora 24.
Can I permanently set my account credentials so I am not asked at every startup? linux, startup, password, account MATLAB Answers — New Questions
How to draw a square with specific plot points
I’m trying to create two squares, one larger one, and the other within it.
I attempted to create one using matrices. I create one with x = [0 0 1 1] and y = [0 1 1 0]
I wanted a line to connect each one of the points, to thus create a line. However, when I did that, I only received three lines connect between the dots for some reason. The bottom points (0,0) and (1,0) for some reason were not connected. I then attempted to make a second square, and the same thing happened, with the two lower points in regards to their Y points did not connect. I tried using the rectangle function as well, but can’t get a square within a square to appear. Any help would be great. ThanksI’m trying to create two squares, one larger one, and the other within it.
I attempted to create one using matrices. I create one with x = [0 0 1 1] and y = [0 1 1 0]
I wanted a line to connect each one of the points, to thus create a line. However, when I did that, I only received three lines connect between the dots for some reason. The bottom points (0,0) and (1,0) for some reason were not connected. I then attempted to make a second square, and the same thing happened, with the two lower points in regards to their Y points did not connect. I tried using the rectangle function as well, but can’t get a square within a square to appear. Any help would be great. Thanks I’m trying to create two squares, one larger one, and the other within it.
I attempted to create one using matrices. I create one with x = [0 0 1 1] and y = [0 1 1 0]
I wanted a line to connect each one of the points, to thus create a line. However, when I did that, I only received three lines connect between the dots for some reason. The bottom points (0,0) and (1,0) for some reason were not connected. I then attempted to make a second square, and the same thing happened, with the two lower points in regards to their Y points did not connect. I tried using the rectangle function as well, but can’t get a square within a square to appear. Any help would be great. Thanks plotting MATLAB Answers — New Questions
Advanced matlab function autocompletion based on previous input
Hello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear allHello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear all Hello Matlab community! first question for me:
Short question: is there an easy/documented way (or is it gonna be implemented in future releases) of providing input autocompletion for functions based on previous inputs?
Context: I found very useful the link below provided in other question/answer about autocompletion but it seems to me it has been somehow abandoned…
https://it.mathworks.com/help/matlab/matlab_prog/customize-code-suggestions-and-completions.html
the usage of mutuallyExclusiveGroup – Definition of set of exclusive arguments goes next by the desired result but not close enough.
To make a practical example my ideal result would be to get to the same user experience level that the function readcell(…) offers: if I provide an xls filename as first input and then type "sheet" matlab knows automatically the sheetnames of that file and suggest them. I tried to navigate inside the readcell(..) code but I think I’m missing something..
The autocompletion approach with the json template is kinda ‘static’ in my opinion, since I don’t know what file the user will enter, I can’t enumerate all the options manually, and I don’t know how to filter something more specific than a file-format like *mat, *xlsx,…
Any workaround? Or maybe I’m just not smart enough to make it work.
Another thing I use consistently for the autocompletion is the "argument (Input)" syntax for my purposes, usually I use
{mustBeMember(__,[option1, option2, ..]} and that helps me a lot to provide fast ways to make autocompletions for end users. But also in this situation I see no way to reuse the information of a previous input.. in example it could be cool, let’s say, having this:
function bill = iWannaEat( restaurant, dish) % < let’s keep things simple and assume this is a simple function, or a static method.
arguments (Input)
restaurant (1,1) KitchenObject
dish (1,:) string {mustBeMember(dish, restaurant.MenuSheet)} = "water" % < but I can’t reuse
% restaurant.MenuSheet,
% because a .MenuSheet must be guaranteed to exist?
end
bill = … things …
end
By the way I appreciate the extraordinary work you do for free to help other programmers with their things!!!
I went through 2014a till the 2024 and the developments has been huge, do you agree?
clc, clear all input validation, code suggestion, autocompletion, previous input, function input, multiple, option based MATLAB Answers — New Questions
Unable to correctly import Spherical Parallel Manipulator CAD files into Simulink. kinematic constraints cannot be maintained error
I am currently working on programming a spherical parallel manipulator. I am very new to matlab and I also have minimal knowledge of programming and calculus.
When I import my onshape assembly into simulink and try to run the simulation I get an error saying that the kinematic constraints cannot be maintained. The simulation works for about 0.007 seconds before returning this error.
This is the exact error message:
An error occurred during simulation and the simulation was terminated
Caused by:
[‘V2_SPM_Assembly/Revolute9’, ‘V2_SPM_Assembly/Solver Configuration’]: ‘V2_SPM_Assembly/Revolute9’ kinematic constraints cannot be maintained. Check solver type and consistency tolerance in the Simscape Solver Configuration block. Check Simulink solver type and tolerances in Model Configuration Parameters. A kinematic singularity might be the source of this problem.
So far I have tried:
Turning down the tolerance. This results in the same error. Although the simulation works for about 0.108 seconds.
Changing the solver type. I tried all of the solver types and they do affect how long the simulation runs before resulting in an error but they never result in a simulation time greater than a second or so.
Redoing the CAD design. I remade the whole design and made sure that every axis of rotation is defined directly off of the origin.
Changing the order in which I assigned the revolute joints. This had no effect.
Replacing "revolute7", "revolute8", and "revolute9", with cylindrical joints. This resulted in a position violation error.
Changing how mate connectors were assigned in onshape part studios. I assigned mate connectors to be aligned with the relative axis of rotation and used those connectors in the joints. When I did not do this then the model resulted in a position violation error.
I have had minor success with:
Turning down the tolerance, and changing the way the joints are defined. I was able to get the model to simulate without an error. However, it only went through about 10 degrees of rotation on the base axis.
Changing the way the mate connectors where assigned in the onshape parts studios was the biggest improvement I have had and it made it so I stopped getting the position violation error.
Simulating the model with only one leg of the spherical parallel manipulator. This worked perfectly but it will not suffice for my project.
What I think the problem is:
I think that the part origins are the issue but I do not know how to correctly define them. The mate connectors help but I am unsure whether they act as coordinate systems for the parts. I have a Solidworks license but it is for Solidworks 2022 and it does not export to Simulink.
If anyone has any suggestions on what else I could try I would love to hear them. I linked my onshape file, and simulink file below as well as an image of the model.
https://cad.onshape.com/documents/d27868ad0436caa3f4afe2cb/w/a233bf5d473eb4ccb1022246/e/4dd27757644eec07373ecc70?renderMode=0&uiState=66542a76150c1c53248dd442I am currently working on programming a spherical parallel manipulator. I am very new to matlab and I also have minimal knowledge of programming and calculus.
When I import my onshape assembly into simulink and try to run the simulation I get an error saying that the kinematic constraints cannot be maintained. The simulation works for about 0.007 seconds before returning this error.
This is the exact error message:
An error occurred during simulation and the simulation was terminated
Caused by:
[‘V2_SPM_Assembly/Revolute9’, ‘V2_SPM_Assembly/Solver Configuration’]: ‘V2_SPM_Assembly/Revolute9’ kinematic constraints cannot be maintained. Check solver type and consistency tolerance in the Simscape Solver Configuration block. Check Simulink solver type and tolerances in Model Configuration Parameters. A kinematic singularity might be the source of this problem.
So far I have tried:
Turning down the tolerance. This results in the same error. Although the simulation works for about 0.108 seconds.
Changing the solver type. I tried all of the solver types and they do affect how long the simulation runs before resulting in an error but they never result in a simulation time greater than a second or so.
Redoing the CAD design. I remade the whole design and made sure that every axis of rotation is defined directly off of the origin.
Changing the order in which I assigned the revolute joints. This had no effect.
Replacing "revolute7", "revolute8", and "revolute9", with cylindrical joints. This resulted in a position violation error.
Changing how mate connectors were assigned in onshape part studios. I assigned mate connectors to be aligned with the relative axis of rotation and used those connectors in the joints. When I did not do this then the model resulted in a position violation error.
I have had minor success with:
Turning down the tolerance, and changing the way the joints are defined. I was able to get the model to simulate without an error. However, it only went through about 10 degrees of rotation on the base axis.
Changing the way the mate connectors where assigned in the onshape parts studios was the biggest improvement I have had and it made it so I stopped getting the position violation error.
Simulating the model with only one leg of the spherical parallel manipulator. This worked perfectly but it will not suffice for my project.
What I think the problem is:
I think that the part origins are the issue but I do not know how to correctly define them. The mate connectors help but I am unsure whether they act as coordinate systems for the parts. I have a Solidworks license but it is for Solidworks 2022 and it does not export to Simulink.
If anyone has any suggestions on what else I could try I would love to hear them. I linked my onshape file, and simulink file below as well as an image of the model.
https://cad.onshape.com/documents/d27868ad0436caa3f4afe2cb/w/a233bf5d473eb4ccb1022246/e/4dd27757644eec07373ecc70?renderMode=0&uiState=66542a76150c1c53248dd442 I am currently working on programming a spherical parallel manipulator. I am very new to matlab and I also have minimal knowledge of programming and calculus.
When I import my onshape assembly into simulink and try to run the simulation I get an error saying that the kinematic constraints cannot be maintained. The simulation works for about 0.007 seconds before returning this error.
This is the exact error message:
An error occurred during simulation and the simulation was terminated
Caused by:
[‘V2_SPM_Assembly/Revolute9’, ‘V2_SPM_Assembly/Solver Configuration’]: ‘V2_SPM_Assembly/Revolute9’ kinematic constraints cannot be maintained. Check solver type and consistency tolerance in the Simscape Solver Configuration block. Check Simulink solver type and tolerances in Model Configuration Parameters. A kinematic singularity might be the source of this problem.
So far I have tried:
Turning down the tolerance. This results in the same error. Although the simulation works for about 0.108 seconds.
Changing the solver type. I tried all of the solver types and they do affect how long the simulation runs before resulting in an error but they never result in a simulation time greater than a second or so.
Redoing the CAD design. I remade the whole design and made sure that every axis of rotation is defined directly off of the origin.
Changing the order in which I assigned the revolute joints. This had no effect.
Replacing "revolute7", "revolute8", and "revolute9", with cylindrical joints. This resulted in a position violation error.
Changing how mate connectors were assigned in onshape part studios. I assigned mate connectors to be aligned with the relative axis of rotation and used those connectors in the joints. When I did not do this then the model resulted in a position violation error.
I have had minor success with:
Turning down the tolerance, and changing the way the joints are defined. I was able to get the model to simulate without an error. However, it only went through about 10 degrees of rotation on the base axis.
Changing the way the mate connectors where assigned in the onshape parts studios was the biggest improvement I have had and it made it so I stopped getting the position violation error.
Simulating the model with only one leg of the spherical parallel manipulator. This worked perfectly but it will not suffice for my project.
What I think the problem is:
I think that the part origins are the issue but I do not know how to correctly define them. The mate connectors help but I am unsure whether they act as coordinate systems for the parts. I have a Solidworks license but it is for Solidworks 2022 and it does not export to Simulink.
If anyone has any suggestions on what else I could try I would love to hear them. I linked my onshape file, and simulink file below as well as an image of the model.
https://cad.onshape.com/documents/d27868ad0436caa3f4afe2cb/w/a233bf5d473eb4ccb1022246/e/4dd27757644eec07373ecc70?renderMode=0&uiState=66542a76150c1c53248dd442 onshape, simulink, smexportonshape, smimport, kinematic constraints, position violation, solidworks, cad, cad import, over defined, assembly, joints, revolute, spherical parallel manipulator, multibody MATLAB Answers — New Questions
Can I add units to the table?
Can I add units to the variables in the table? I have searched for information and I could not find anything, it can only be done in numbers …please helpCan I add units to the variables in the table? I have searched for information and I could not find anything, it can only be done in numbers …please help Can I add units to the variables in the table? I have searched for information and I could not find anything, it can only be done in numbers …please help units, tables, variables MATLAB Answers — New Questions
Creating a Square Matrix from a Variable “Plug-In”, Keeping Each Row In The Matrix Fixed To One Value
Hello everyone,
I am trying to create a square matrix that is N x N in size. In my case, N = 23.
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be fixed.
My goal is to generate a matrix with my "Kernel" variables that have different values of "z_prime", but keeping "z" fixed as a variable.
However, I need to keep each row of the "Kernel" matrix fixed to one "z_prime" value.
Which means each row will have its own "z_prime" value and thus each row will have its own "Kernel" value.
I attached my "value list" of "z_prime".
See excel sheet attached:
z_prime_value_list.xlsx
I attached a screenshot showing the type of matrix I am trying to generate
See .PNG file attached:
Kernel Matrix.png
…all the way until K(z,z_prime_23).
In my attempt, I have tried to use for loops and creating function handles to make it easier to generate this matrix. However, I still got a "1 x 23" matrix instead of the "23×23" matrix I was trying to get.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Square_Matrix.m
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X N" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding square matrices. However, I wasn’t able to find anything that was relevant to my case.Hello everyone,
I am trying to create a square matrix that is N x N in size. In my case, N = 23.
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be fixed.
My goal is to generate a matrix with my "Kernel" variables that have different values of "z_prime", but keeping "z" fixed as a variable.
However, I need to keep each row of the "Kernel" matrix fixed to one "z_prime" value.
Which means each row will have its own "z_prime" value and thus each row will have its own "Kernel" value.
I attached my "value list" of "z_prime".
See excel sheet attached:
z_prime_value_list.xlsx
I attached a screenshot showing the type of matrix I am trying to generate
See .PNG file attached:
Kernel Matrix.png
…all the way until K(z,z_prime_23).
In my attempt, I have tried to use for loops and creating function handles to make it easier to generate this matrix. However, I still got a "1 x 23" matrix instead of the "23×23" matrix I was trying to get.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Square_Matrix.m
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X N" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding square matrices. However, I wasn’t able to find anything that was relevant to my case. Hello everyone,
I am trying to create a square matrix that is N x N in size. In my case, N = 23.
I have a variable that’s called "Kernel". This variable is calculated as an equation in terms of "z" and "z_prime".
My values in z_prime will vary from L / 2N to (2N-1)*(L/2N) , in steps of "L/N".
My "z" variable will be fixed.
My goal is to generate a matrix with my "Kernel" variables that have different values of "z_prime", but keeping "z" fixed as a variable.
However, I need to keep each row of the "Kernel" matrix fixed to one "z_prime" value.
Which means each row will have its own "z_prime" value and thus each row will have its own "Kernel" value.
I attached my "value list" of "z_prime".
See excel sheet attached:
z_prime_value_list.xlsx
I attached a screenshot showing the type of matrix I am trying to generate
See .PNG file attached:
Kernel Matrix.png
…all the way until K(z,z_prime_23).
In my attempt, I have tried to use for loops and creating function handles to make it easier to generate this matrix. However, I still got a "1 x 23" matrix instead of the "23×23" matrix I was trying to get.
I attached my MATLAB Code for reference.
See MATLAB .m file attached:
Square_Matrix.m
I know that there is a way to use "nested" for loops to generate a square matrix of an "N X N" size. However, I wasn’t quite sure on how to implement that in MATLAB for my case.
I have tried to look through different questions/answers on the Mathworks Forum regarding square matrices. However, I wasn’t able to find anything that was relevant to my case. matrices, for loop, for loops, nested for loop, nested for loops, function handles MATLAB Answers — New Questions
Real time NI-DAQ data plot in Matlab with animatedline.
I tested this code and it works, but I would like to change it so that the time in seconds appears on the x-axis and not datetime. More precisely, I want to set the time limits of the x-axis to be between 0 and 10 seconds and then stop aquisition, so that I can display the signal from ni daq usb 6001. I also want that at the end of the acquisition, the entire signal remains displayed in the graph. Please, if possible, answer me.
As the code shows, I can read the data, live, but at the end of the 10 seconds the graph disappears, but I want it not to disappear. Once again, I want the x-axis to display the time in seconds and to remain stable (axis does not move, only the signal).
clear
close all
time = 0;
data = 0;
`% Set up the plot`
figure(1)
plotGraph = plot(time,data,’-r’ );
title(‘DAQ data log’,’FontSize’,15);
xlabel (‘Elapsed Time (s)’,’FontSize’,10)
ylabel(‘Voltage (V)’,’FontSize’,10);
h = animatedline;
ax = gca;
ax.YGrid = ‘on’;
ax.XGrid = ‘on’;
% Set up the data acquisition
dq = daq("ni");
ch1 = addinput(dq, "Dev1", "ai0", "Voltage");
dq.Rate = 1000;
% Start the data acquisition
start(dq, "Duration", seconds(10))
n = ceil(dq.Rate/10);
while ishandle(plotGraph)
data = read(dq, n);
voltage = data.Dev1_ai0;
t = datetime(‘now’);
for i = 1:100
% Add points to animated line
if isvalid(h)
addpoints(h, datenum(t), voltage(i))
end
end
% Update axes
ax.XLim = datenum([t-seconds(15) t]);
datetick(‘x’,’keeplimits’)
drawnow
end
disp(‘Plot Closed’)I tested this code and it works, but I would like to change it so that the time in seconds appears on the x-axis and not datetime. More precisely, I want to set the time limits of the x-axis to be between 0 and 10 seconds and then stop aquisition, so that I can display the signal from ni daq usb 6001. I also want that at the end of the acquisition, the entire signal remains displayed in the graph. Please, if possible, answer me.
As the code shows, I can read the data, live, but at the end of the 10 seconds the graph disappears, but I want it not to disappear. Once again, I want the x-axis to display the time in seconds and to remain stable (axis does not move, only the signal).
clear
close all
time = 0;
data = 0;
`% Set up the plot`
figure(1)
plotGraph = plot(time,data,’-r’ );
title(‘DAQ data log’,’FontSize’,15);
xlabel (‘Elapsed Time (s)’,’FontSize’,10)
ylabel(‘Voltage (V)’,’FontSize’,10);
h = animatedline;
ax = gca;
ax.YGrid = ‘on’;
ax.XGrid = ‘on’;
% Set up the data acquisition
dq = daq("ni");
ch1 = addinput(dq, "Dev1", "ai0", "Voltage");
dq.Rate = 1000;
% Start the data acquisition
start(dq, "Duration", seconds(10))
n = ceil(dq.Rate/10);
while ishandle(plotGraph)
data = read(dq, n);
voltage = data.Dev1_ai0;
t = datetime(‘now’);
for i = 1:100
% Add points to animated line
if isvalid(h)
addpoints(h, datenum(t), voltage(i))
end
end
% Update axes
ax.XLim = datenum([t-seconds(15) t]);
datetick(‘x’,’keeplimits’)
drawnow
end
disp(‘Plot Closed’) I tested this code and it works, but I would like to change it so that the time in seconds appears on the x-axis and not datetime. More precisely, I want to set the time limits of the x-axis to be between 0 and 10 seconds and then stop aquisition, so that I can display the signal from ni daq usb 6001. I also want that at the end of the acquisition, the entire signal remains displayed in the graph. Please, if possible, answer me.
As the code shows, I can read the data, live, but at the end of the 10 seconds the graph disappears, but I want it not to disappear. Once again, I want the x-axis to display the time in seconds and to remain stable (axis does not move, only the signal).
clear
close all
time = 0;
data = 0;
`% Set up the plot`
figure(1)
plotGraph = plot(time,data,’-r’ );
title(‘DAQ data log’,’FontSize’,15);
xlabel (‘Elapsed Time (s)’,’FontSize’,10)
ylabel(‘Voltage (V)’,’FontSize’,10);
h = animatedline;
ax = gca;
ax.YGrid = ‘on’;
ax.XGrid = ‘on’;
% Set up the data acquisition
dq = daq("ni");
ch1 = addinput(dq, "Dev1", "ai0", "Voltage");
dq.Rate = 1000;
% Start the data acquisition
start(dq, "Duration", seconds(10))
n = ceil(dq.Rate/10);
while ishandle(plotGraph)
data = read(dq, n);
voltage = data.Dev1_ai0;
t = datetime(‘now’);
for i = 1:100
% Add points to animated line
if isvalid(h)
addpoints(h, datenum(t), voltage(i))
end
end
% Update axes
ax.XLim = datenum([t-seconds(15) t]);
datetick(‘x’,’keeplimits’)
drawnow
end
disp(‘Plot Closed’) real-time-data, ni-usb-6001 MATLAB Answers — New Questions
To discribe Lmi term-regarding
Hai Team,
I am NARENSHAKTHI T. Recently working related to LMI tool box. Usually I used to represent the term as lmiterm([lmi 1 1 O1],-2,1), where O1 is a matrix. If I want to add an element’s inverse term as lmiterm([lmi 1 1 inv(O1)],-2,1), But it gives error. so i want your guidance team.
Thanks in adavanceHai Team,
I am NARENSHAKTHI T. Recently working related to LMI tool box. Usually I used to represent the term as lmiterm([lmi 1 1 O1],-2,1), where O1 is a matrix. If I want to add an element’s inverse term as lmiterm([lmi 1 1 inv(O1)],-2,1), But it gives error. so i want your guidance team.
Thanks in adavance Hai Team,
I am NARENSHAKTHI T. Recently working related to LMI tool box. Usually I used to represent the term as lmiterm([lmi 1 1 O1],-2,1), where O1 is a matrix. If I want to add an element’s inverse term as lmiterm([lmi 1 1 inv(O1)],-2,1), But it gives error. so i want your guidance team.
Thanks in adavance lmi term MATLAB Answers — New Questions
How to pull out data from cell array, concatenate it, and put into table for varying trials
Hello there, I have data from 10 trials stored in a 1×10 cell array "Predictors" and I want to create a loop that pulls out one trial at a time and then concatonates the data in all the other trials and saves it under a unique or numbered variable name? I am thinking something like this. I am not sure how to have it number each iteration:
for i = 1:length(Predictors)
Test_i = Predictors(i)
trainindicies_i = setdiff(1:length(Predictors),i);
Train_i = Predictors(trainindicies)
TrainX_i = vertcat(Train_i{:})
endHello there, I have data from 10 trials stored in a 1×10 cell array "Predictors" and I want to create a loop that pulls out one trial at a time and then concatonates the data in all the other trials and saves it under a unique or numbered variable name? I am thinking something like this. I am not sure how to have it number each iteration:
for i = 1:length(Predictors)
Test_i = Predictors(i)
trainindicies_i = setdiff(1:length(Predictors),i);
Train_i = Predictors(trainindicies)
TrainX_i = vertcat(Train_i{:})
end Hello there, I have data from 10 trials stored in a 1×10 cell array "Predictors" and I want to create a loop that pulls out one trial at a time and then concatonates the data in all the other trials and saves it under a unique or numbered variable name? I am thinking something like this. I am not sure how to have it number each iteration:
for i = 1:length(Predictors)
Test_i = Predictors(i)
trainindicies_i = setdiff(1:length(Predictors),i);
Train_i = Predictors(trainindicies)
TrainX_i = vertcat(Train_i{:})
end concatonate, tables, data formatting MATLAB Answers — New Questions