Category: Matlab
Category Archives: Matlab
Downgrade project with reference models and sub-models from 2023 to 2021
Hi all,
I have a project in matlab 2023 which contains a plenty of reference models and sub-models, it would not be nice downgrading all the models one by one, so I would like to downgrade the whole project from 2023 to 2021.
Does any of you knows a way to perform such a task with a script or anything like that?Hi all,
I have a project in matlab 2023 which contains a plenty of reference models and sub-models, it would not be nice downgrading all the models one by one, so I would like to downgrade the whole project from 2023 to 2021.
Does any of you knows a way to perform such a task with a script or anything like that? Hi all,
I have a project in matlab 2023 which contains a plenty of reference models and sub-models, it would not be nice downgrading all the models one by one, so I would like to downgrade the whole project from 2023 to 2021.
Does any of you knows a way to perform such a task with a script or anything like that? downgrade, simulink MATLAB Answers — New Questions
Error Using Rainflow fonction
Hello everyone,
I’m not really good at Matlab, but I need to use it to process some load cycles result using the rainflow function (please see attachment)
I have written the code as below
clear all,
clc,
[filename,pathname] = uigetfile({‘*.xlsx;*.xlsm’,’Excel Worksheets (*.xlsx,*.xlsm)’},’Select File’);
[file,sheets] = xlsfinfo([pathname,filename]);
num_1 = xlsread(filename);
[num_3, txt]= xlsread(filename);
%read only row and column with number
Data_1 = num_3(4:end,:); % 4:end, –> choose all the row start from 4 % : –> choose all the column % start at row 4 and read all column
X = num_3(4:end,7); % 4,–> Choose only row 4 seread oly row 4 and all column.
Y = num_3(4:end,6);
Z = num_3(4:end,8);
figure(1)
plot3(X,Y,Z);
t = linspace(min(Y),max(Y),length(Z)/10);
d = linspace(min(Y),max(Y),length(Z)/5);
figure(2)
Z = [X Y]
rainflow(Z,t);
and unfortunately have the errors below after the code:
Error using rainflow
Expected X to be a vector.
Error in rainflow>parseInputs (line 184)
validateattributes(x,{‘single’,’double’},…
Error in rainflow (line 81)
[x,t,ext,td] = parseInputs(x,varargin{:});
Error in KW31_BMW_Load_Cycle_Ju (line 39)
rainflow(Z,t)
Can someone please tell me were I´making the mytake by using the Rainflow function?
Thank in advanceHello everyone,
I’m not really good at Matlab, but I need to use it to process some load cycles result using the rainflow function (please see attachment)
I have written the code as below
clear all,
clc,
[filename,pathname] = uigetfile({‘*.xlsx;*.xlsm’,’Excel Worksheets (*.xlsx,*.xlsm)’},’Select File’);
[file,sheets] = xlsfinfo([pathname,filename]);
num_1 = xlsread(filename);
[num_3, txt]= xlsread(filename);
%read only row and column with number
Data_1 = num_3(4:end,:); % 4:end, –> choose all the row start from 4 % : –> choose all the column % start at row 4 and read all column
X = num_3(4:end,7); % 4,–> Choose only row 4 seread oly row 4 and all column.
Y = num_3(4:end,6);
Z = num_3(4:end,8);
figure(1)
plot3(X,Y,Z);
t = linspace(min(Y),max(Y),length(Z)/10);
d = linspace(min(Y),max(Y),length(Z)/5);
figure(2)
Z = [X Y]
rainflow(Z,t);
and unfortunately have the errors below after the code:
Error using rainflow
Expected X to be a vector.
Error in rainflow>parseInputs (line 184)
validateattributes(x,{‘single’,’double’},…
Error in rainflow (line 81)
[x,t,ext,td] = parseInputs(x,varargin{:});
Error in KW31_BMW_Load_Cycle_Ju (line 39)
rainflow(Z,t)
Can someone please tell me were I´making the mytake by using the Rainflow function?
Thank in advance Hello everyone,
I’m not really good at Matlab, but I need to use it to process some load cycles result using the rainflow function (please see attachment)
I have written the code as below
clear all,
clc,
[filename,pathname] = uigetfile({‘*.xlsx;*.xlsm’,’Excel Worksheets (*.xlsx,*.xlsm)’},’Select File’);
[file,sheets] = xlsfinfo([pathname,filename]);
num_1 = xlsread(filename);
[num_3, txt]= xlsread(filename);
%read only row and column with number
Data_1 = num_3(4:end,:); % 4:end, –> choose all the row start from 4 % : –> choose all the column % start at row 4 and read all column
X = num_3(4:end,7); % 4,–> Choose only row 4 seread oly row 4 and all column.
Y = num_3(4:end,6);
Z = num_3(4:end,8);
figure(1)
plot3(X,Y,Z);
t = linspace(min(Y),max(Y),length(Z)/10);
d = linspace(min(Y),max(Y),length(Z)/5);
figure(2)
Z = [X Y]
rainflow(Z,t);
and unfortunately have the errors below after the code:
Error using rainflow
Expected X to be a vector.
Error in rainflow>parseInputs (line 184)
validateattributes(x,{‘single’,’double’},…
Error in rainflow (line 81)
[x,t,ext,td] = parseInputs(x,varargin{:});
Error in KW31_BMW_Load_Cycle_Ju (line 39)
rainflow(Z,t)
Can someone please tell me were I´making the mytake by using the Rainflow function?
Thank in advance hello togheter i´m trying to plot a rainflow MATLAB Answers — New Questions
Resolution of a plotted function
Hello Everyone,
I need to put this function (f) in a matrix to print it as a figure, but how can I put it in the same matrix (4001, 3001) with two resolutions (1um, 2um) and the same wavelength 100um?
May someone please help me in solving this query.
Thanks
f = @(x) 3*sin(x*2*pi/wavelength) + 1003;
% The function for the sine wave with the
% amplitude 3 µm and wave length of about 100 µm.
%Mean level is 1003 µm.Hello Everyone,
I need to put this function (f) in a matrix to print it as a figure, but how can I put it in the same matrix (4001, 3001) with two resolutions (1um, 2um) and the same wavelength 100um?
May someone please help me in solving this query.
Thanks
f = @(x) 3*sin(x*2*pi/wavelength) + 1003;
% The function for the sine wave with the
% amplitude 3 µm and wave length of about 100 µm.
%Mean level is 1003 µm. Hello Everyone,
I need to put this function (f) in a matrix to print it as a figure, but how can I put it in the same matrix (4001, 3001) with two resolutions (1um, 2um) and the same wavelength 100um?
May someone please help me in solving this query.
Thanks
f = @(x) 3*sin(x*2*pi/wavelength) + 1003;
% The function for the sine wave with the
% amplitude 3 µm and wave length of about 100 µm.
%Mean level is 1003 µm. resolution MATLAB Answers — New Questions
How to Plot a Fourier Series?
Hi,
I was given a half range expansion function f(x) = 0, 0<x<2 and f(x) = 1, <2<x<4.
I was asked to solve for the Fourier cosine series and Fourier sine series and then plot each.
I solved by hand:
Fourier Cosine Series:
a0 = 1/2
an = -2/(n*pi)*sin((n*pi)/2)
f(x) = 1/2 + sum(an*cos((n*pi*x)/4)) from n =1 to infinity
Fourier Sine Series:
bn = [2/(n*pi)]*[(-1)^(n+1) + cos((n*pi)/2)]
f(x) = sum(bn*sin((n*pi*x)/4))
I’m fairly new to Matlab and very unexperienced, where I’m having dificulty is plotting these functions against x, say x = [-24 24] and n=1:1:50 or until square waves appear. I gained some experience plotting their partial sums using fplot, but that approach does not appear to work here. It isn’t feasible to plot the 50th partial sum. I’ve seen more arrayfun usage online, but I do not understand it whatsoever.
Any help and explanation would be greatly appreciated. Thanks in advance.Hi,
I was given a half range expansion function f(x) = 0, 0<x<2 and f(x) = 1, <2<x<4.
I was asked to solve for the Fourier cosine series and Fourier sine series and then plot each.
I solved by hand:
Fourier Cosine Series:
a0 = 1/2
an = -2/(n*pi)*sin((n*pi)/2)
f(x) = 1/2 + sum(an*cos((n*pi*x)/4)) from n =1 to infinity
Fourier Sine Series:
bn = [2/(n*pi)]*[(-1)^(n+1) + cos((n*pi)/2)]
f(x) = sum(bn*sin((n*pi*x)/4))
I’m fairly new to Matlab and very unexperienced, where I’m having dificulty is plotting these functions against x, say x = [-24 24] and n=1:1:50 or until square waves appear. I gained some experience plotting their partial sums using fplot, but that approach does not appear to work here. It isn’t feasible to plot the 50th partial sum. I’ve seen more arrayfun usage online, but I do not understand it whatsoever.
Any help and explanation would be greatly appreciated. Thanks in advance. Hi,
I was given a half range expansion function f(x) = 0, 0<x<2 and f(x) = 1, <2<x<4.
I was asked to solve for the Fourier cosine series and Fourier sine series and then plot each.
I solved by hand:
Fourier Cosine Series:
a0 = 1/2
an = -2/(n*pi)*sin((n*pi)/2)
f(x) = 1/2 + sum(an*cos((n*pi*x)/4)) from n =1 to infinity
Fourier Sine Series:
bn = [2/(n*pi)]*[(-1)^(n+1) + cos((n*pi)/2)]
f(x) = sum(bn*sin((n*pi*x)/4))
I’m fairly new to Matlab and very unexperienced, where I’m having dificulty is plotting these functions against x, say x = [-24 24] and n=1:1:50 or until square waves appear. I gained some experience plotting their partial sums using fplot, but that approach does not appear to work here. It isn’t feasible to plot the 50th partial sum. I’ve seen more arrayfun usage online, but I do not understand it whatsoever.
Any help and explanation would be greatly appreciated. Thanks in advance. arrays, function, time series MATLAB Answers — New Questions
Error accessing camera connected to NVIDIA Jetson AGX ORIN 64 Gb development kit
I am trying to access camera connected to Nvidia Jeston AGX orin. The camera model is: See3CAM_CU135M_H03R1 (econsystem usb 3). The camera is working properly in Nvidia Jeston. But when i am trying to use it on matlab i am having the following output and error:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Gathering hardware details is complete.
Board name : NVIDIA Jetson AGX Orin Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version : 1.2
OpenCV Version : 4.8.0
Available Webcams : See3CAM_CU135M_H03R1
Available GPUs : Orin
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Available Webcams:
1: See3CAM_CU135M_H03R1
Details of Webcam 1: See3CAM_CU135M_H03R1
Error initializing camera See3CAM_CU135M_H03R1: Gstreamer pipeline error. Make sure that the camera is not opened.
The code which i used is given below:
clear all
close all
clc
% Connect to the Jetson
hwJetson = jetson(‘10.134.169.67’, ‘JetsonCam’, ‘ws132’);
% List the available webcams
webcams = hwJetson.WebcamList;
% Display the list of webcams
disp(‘Available Webcams:’);
for i = 1:length(webcams)
fprintf(‘%d: %sn’, i, webcams{i});
end
% Get detailed information about each webcam
for i = 1:length(webcams)
camName = webcams{i};
fprintf(‘nDetails of Webcam %d: %sn’, i, camName);
% Try to initialize the camera with a specific resolution and frame rate
try
% Initialize the camera with the default resolution and frame rate
cam = camera(hwJetson, camName, [1280 720]); % Example resolution and frame rate
% Display video modes supported by the camera
videoModes = cam.AvailableResolutions;
% Print available resolutions
fprintf(‘Available Resolutions:n’);
for j = 1:length(videoModes)
fprintf(‘Resolution %d: %sn’, j, videoModes{j});
end
% Clean up
clear cam;
catch ME
% Display an error message if the camera initialization fails
fprintf(‘Error initializing camera %s: %sn’, camName, ME.message);
end
endI am trying to access camera connected to Nvidia Jeston AGX orin. The camera model is: See3CAM_CU135M_H03R1 (econsystem usb 3). The camera is working properly in Nvidia Jeston. But when i am trying to use it on matlab i am having the following output and error:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Gathering hardware details is complete.
Board name : NVIDIA Jetson AGX Orin Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version : 1.2
OpenCV Version : 4.8.0
Available Webcams : See3CAM_CU135M_H03R1
Available GPUs : Orin
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Available Webcams:
1: See3CAM_CU135M_H03R1
Details of Webcam 1: See3CAM_CU135M_H03R1
Error initializing camera See3CAM_CU135M_H03R1: Gstreamer pipeline error. Make sure that the camera is not opened.
The code which i used is given below:
clear all
close all
clc
% Connect to the Jetson
hwJetson = jetson(‘10.134.169.67’, ‘JetsonCam’, ‘ws132’);
% List the available webcams
webcams = hwJetson.WebcamList;
% Display the list of webcams
disp(‘Available Webcams:’);
for i = 1:length(webcams)
fprintf(‘%d: %sn’, i, webcams{i});
end
% Get detailed information about each webcam
for i = 1:length(webcams)
camName = webcams{i};
fprintf(‘nDetails of Webcam %d: %sn’, i, camName);
% Try to initialize the camera with a specific resolution and frame rate
try
% Initialize the camera with the default resolution and frame rate
cam = camera(hwJetson, camName, [1280 720]); % Example resolution and frame rate
% Display video modes supported by the camera
videoModes = cam.AvailableResolutions;
% Print available resolutions
fprintf(‘Available Resolutions:n’);
for j = 1:length(videoModes)
fprintf(‘Resolution %d: %sn’, j, videoModes{j});
end
% Clean up
clear cam;
catch ME
% Display an error message if the camera initialization fails
fprintf(‘Error initializing camera %s: %sn’, camName, ME.message);
end
end I am trying to access camera connected to Nvidia Jeston AGX orin. The camera model is: See3CAM_CU135M_H03R1 (econsystem usb 3). The camera is working properly in Nvidia Jeston. But when i am trying to use it on matlab i am having the following output and error:
Checking for CUDA availability on the Target…
Checking for ‘nvcc’ in the target system path…
Checking for cuDNN library availability on the Target…
Checking for TensorRT library availability on the Target…
Checking for prerequisite libraries is complete.
Gathering hardware details…
Checking for third-party library availability on the Target…
Gathering hardware details is complete.
Board name : NVIDIA Jetson AGX Orin Developer Kit
CUDA Version : 12.2
cuDNN Version : 8.9
TensorRT Version : 8.6
GStreamer Version : 1.20.3
V4L2 Version : 1.22.1-2build1
SDL Version : 1.2
OpenCV Version : 4.8.0
Available Webcams : See3CAM_CU135M_H03R1
Available GPUs : Orin
Available Digital Pins : 7 11 12 13 15 16 18 19 21 22 23 24 26 29 31 32 33 35 36 37 38 40
Available Webcams:
1: See3CAM_CU135M_H03R1
Details of Webcam 1: See3CAM_CU135M_H03R1
Error initializing camera See3CAM_CU135M_H03R1: Gstreamer pipeline error. Make sure that the camera is not opened.
The code which i used is given below:
clear all
close all
clc
% Connect to the Jetson
hwJetson = jetson(‘10.134.169.67’, ‘JetsonCam’, ‘ws132’);
% List the available webcams
webcams = hwJetson.WebcamList;
% Display the list of webcams
disp(‘Available Webcams:’);
for i = 1:length(webcams)
fprintf(‘%d: %sn’, i, webcams{i});
end
% Get detailed information about each webcam
for i = 1:length(webcams)
camName = webcams{i};
fprintf(‘nDetails of Webcam %d: %sn’, i, camName);
% Try to initialize the camera with a specific resolution and frame rate
try
% Initialize the camera with the default resolution and frame rate
cam = camera(hwJetson, camName, [1280 720]); % Example resolution and frame rate
% Display video modes supported by the camera
videoModes = cam.AvailableResolutions;
% Print available resolutions
fprintf(‘Available Resolutions:n’);
for j = 1:length(videoModes)
fprintf(‘Resolution %d: %sn’, j, videoModes{j});
end
% Clean up
clear cam;
catch ME
% Display an error message if the camera initialization fails
fprintf(‘Error initializing camera %s: %sn’, camName, ME.message);
end
end nvidia jetson, camera, image aquisition MATLAB Answers — New Questions
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