Tag Archives: matlab
How to set upper x-axis ticks values and locations?
I am trying to set the upper x-axis (ax2) tick values and locations:
x_a = linspace(71.8131,36.9931,10);
y = linspace(0.16,1,10);
x_b = linspace(0.0163,0.0069,10)./0.1016;
figure;
ax1 = axes;
plot(ax1, x_a, y, ‘k’);
ax2 = axes(‘Position’, ax1.Position, …
‘XAxisLocation’, ‘top’, …
‘YAxisLocation’, ‘right’, …
‘Color’, ‘none’, …
‘XColor’, ‘#88419d’, …
‘YColor’, ‘none’, …
‘Box’, ‘off’);
ax2.YLim = ax1.YLim;
new_tick_locations = linspace(30, 80, 6);
new_tick_labels = arrayfun(@(val) sprintf(‘%.2f’, val/500), new_tick_locations, ‘UniformOutput’, false);
set(ax2, ‘XTick’, new_tick_locations, ‘XTickLabel’, new_tick_labels);
% linkaxes([ax1 ax2], ‘xy’);
hold(ax2, ‘on’);
plot(ax2, x_b, y, ‘r’);
This code doesn’t show the ax2 ticks at all. I need them to show and to be aligned with the lower x axis labels [30, 40, 50, 60, 70, 80]. How can I fix this? Thank you in advance.I am trying to set the upper x-axis (ax2) tick values and locations:
x_a = linspace(71.8131,36.9931,10);
y = linspace(0.16,1,10);
x_b = linspace(0.0163,0.0069,10)./0.1016;
figure;
ax1 = axes;
plot(ax1, x_a, y, ‘k’);
ax2 = axes(‘Position’, ax1.Position, …
‘XAxisLocation’, ‘top’, …
‘YAxisLocation’, ‘right’, …
‘Color’, ‘none’, …
‘XColor’, ‘#88419d’, …
‘YColor’, ‘none’, …
‘Box’, ‘off’);
ax2.YLim = ax1.YLim;
new_tick_locations = linspace(30, 80, 6);
new_tick_labels = arrayfun(@(val) sprintf(‘%.2f’, val/500), new_tick_locations, ‘UniformOutput’, false);
set(ax2, ‘XTick’, new_tick_locations, ‘XTickLabel’, new_tick_labels);
% linkaxes([ax1 ax2], ‘xy’);
hold(ax2, ‘on’);
plot(ax2, x_b, y, ‘r’);
This code doesn’t show the ax2 ticks at all. I need them to show and to be aligned with the lower x axis labels [30, 40, 50, 60, 70, 80]. How can I fix this? Thank you in advance. I am trying to set the upper x-axis (ax2) tick values and locations:
x_a = linspace(71.8131,36.9931,10);
y = linspace(0.16,1,10);
x_b = linspace(0.0163,0.0069,10)./0.1016;
figure;
ax1 = axes;
plot(ax1, x_a, y, ‘k’);
ax2 = axes(‘Position’, ax1.Position, …
‘XAxisLocation’, ‘top’, …
‘YAxisLocation’, ‘right’, …
‘Color’, ‘none’, …
‘XColor’, ‘#88419d’, …
‘YColor’, ‘none’, …
‘Box’, ‘off’);
ax2.YLim = ax1.YLim;
new_tick_locations = linspace(30, 80, 6);
new_tick_labels = arrayfun(@(val) sprintf(‘%.2f’, val/500), new_tick_locations, ‘UniformOutput’, false);
set(ax2, ‘XTick’, new_tick_locations, ‘XTickLabel’, new_tick_labels);
% linkaxes([ax1 ax2], ‘xy’);
hold(ax2, ‘on’);
plot(ax2, x_b, y, ‘r’);
This code doesn’t show the ax2 ticks at all. I need them to show and to be aligned with the lower x axis labels [30, 40, 50, 60, 70, 80]. How can I fix this? Thank you in advance. plot MATLAB Answers — New Questions
Error #15300: No compiled data for the block available while generation code with target link which model includes user libraries.
-> I am doing automation on simulink model which includes targetlink blocks(which also have user defined library blocks). As per my requirement I am editing library model as well and trying to generate code. If my model includes Library models which have function block the code genetation is not happening and throughing Error #15300 error. I have crosschecked my libraries are saved correctly and all the links are correct in model as well.
I fould some unintentional changes on inport and outport blocks after I run my script on model.Please find below higlighted properties which are updating without intention.If I retaine these chages and generating code its susscessfully generating.
Could any one please help how these settings are getting modified and how can we access these propertis trhough script. Info:these are targetlink port used inside simulink model.-> I am doing automation on simulink model which includes targetlink blocks(which also have user defined library blocks). As per my requirement I am editing library model as well and trying to generate code. If my model includes Library models which have function block the code genetation is not happening and throughing Error #15300 error. I have crosschecked my libraries are saved correctly and all the links are correct in model as well.
I fould some unintentional changes on inport and outport blocks after I run my script on model.Please find below higlighted properties which are updating without intention.If I retaine these chages and generating code its susscessfully generating.
Could any one please help how these settings are getting modified and how can we access these propertis trhough script. Info:these are targetlink port used inside simulink model. -> I am doing automation on simulink model which includes targetlink blocks(which also have user defined library blocks). As per my requirement I am editing library model as well and trying to generate code. If my model includes Library models which have function block the code genetation is not happening and throughing Error #15300 error. I have crosschecked my libraries are saved correctly and all the links are correct in model as well.
I fould some unintentional changes on inport and outport blocks after I run my script on model.Please find below higlighted properties which are updating without intention.If I retaine these chages and generating code its susscessfully generating.
Could any one please help how these settings are getting modified and how can we access these propertis trhough script. Info:these are targetlink port used inside simulink model. library modification using scripts MATLAB Answers — New Questions
Is there a way to reduce the amount of RAM/Disk used during parallel simulations (parsim/batchsim)? Ex: Receiving “Out of Memory” error
I am simulating a model using "parsim". When I perform a small number of simulations, the memory usage is below my hardware limits, however when I perform many more simulations in parallel, the RAM usage increases steadily after each simulation and I run out of memory. There are a lot of signals being logged by the model.
How can I reduce the amount of RAM that my parallel simulations are using?I am simulating a model using "parsim". When I perform a small number of simulations, the memory usage is below my hardware limits, however when I perform many more simulations in parallel, the RAM usage increases steadily after each simulation and I run out of memory. There are a lot of signals being logged by the model.
How can I reduce the amount of RAM that my parallel simulations are using? I am simulating a model using "parsim". When I perform a small number of simulations, the memory usage is below my hardware limits, however when I perform many more simulations in parallel, the RAM usage increases steadily after each simulation and I run out of memory. There are a lot of signals being logged by the model.
How can I reduce the amount of RAM that my parallel simulations are using? MATLAB Answers — New Questions
Displaying Live Occupancy Grid
The problem I’ve got is when using show() for occupancy grids within Navigation Toolbox -> Mapping I have a problem when I try to display a live occupancy grid which I’m generating from a LIDAR stream then I can’t manipulate the plot that is generated (move, zoom etc) as it defaults back to the original viewing angle and zoom every time show() is called.
I’ve been scouring the web for any guidance but nothing is coming up so I would appreciate any assistance – thanks!The problem I’ve got is when using show() for occupancy grids within Navigation Toolbox -> Mapping I have a problem when I try to display a live occupancy grid which I’m generating from a LIDAR stream then I can’t manipulate the plot that is generated (move, zoom etc) as it defaults back to the original viewing angle and zoom every time show() is called.
I’ve been scouring the web for any guidance but nothing is coming up so I would appreciate any assistance – thanks! The problem I’ve got is when using show() for occupancy grids within Navigation Toolbox -> Mapping I have a problem when I try to display a live occupancy grid which I’m generating from a LIDAR stream then I can’t manipulate the plot that is generated (move, zoom etc) as it defaults back to the original viewing angle and zoom every time show() is called.
I’ve been scouring the web for any guidance but nothing is coming up so I would appreciate any assistance – thanks! mapping, occupancy grids, lidar MATLAB Answers — New Questions
Can I use fmincon with a whole model as function?
I am currently working on an optimization for a flow and electric current problem. The parameters to be optimized are geometric parameters like lengths, diameters, thicknesses of channels etc. I want to use fmincon, but to my understanding I would need to define a function that is dependent on my variables. However the problem itself needs to iterate before a solution is found. Therefore, fmincon would need to put the values of x into the flow and current model, calculate values for current efficiency and pressure drop, and then use these values to optimize. Is that in someway possible? and if yes, how would I define fmincon and the function itself? The model itself is too big to put in, but i will try to give an example:
The value of Dp depends on the input parameters defined in x and the same goes for Ic,k but cannot immediatly be linked to them since they first need to iterate. Fmincon then needs to find an optimum for the system efficiency, which is defined as . So basically my function would be something like , where x is a vector containing values for channel length, diameter, depth etc. Hopefully this is somewhat clear.I am currently working on an optimization for a flow and electric current problem. The parameters to be optimized are geometric parameters like lengths, diameters, thicknesses of channels etc. I want to use fmincon, but to my understanding I would need to define a function that is dependent on my variables. However the problem itself needs to iterate before a solution is found. Therefore, fmincon would need to put the values of x into the flow and current model, calculate values for current efficiency and pressure drop, and then use these values to optimize. Is that in someway possible? and if yes, how would I define fmincon and the function itself? The model itself is too big to put in, but i will try to give an example:
The value of Dp depends on the input parameters defined in x and the same goes for Ic,k but cannot immediatly be linked to them since they first need to iterate. Fmincon then needs to find an optimum for the system efficiency, which is defined as . So basically my function would be something like , where x is a vector containing values for channel length, diameter, depth etc. Hopefully this is somewhat clear. I am currently working on an optimization for a flow and electric current problem. The parameters to be optimized are geometric parameters like lengths, diameters, thicknesses of channels etc. I want to use fmincon, but to my understanding I would need to define a function that is dependent on my variables. However the problem itself needs to iterate before a solution is found. Therefore, fmincon would need to put the values of x into the flow and current model, calculate values for current efficiency and pressure drop, and then use these values to optimize. Is that in someway possible? and if yes, how would I define fmincon and the function itself? The model itself is too big to put in, but i will try to give an example:
The value of Dp depends on the input parameters defined in x and the same goes for Ic,k but cannot immediatly be linked to them since they first need to iterate. Fmincon then needs to find an optimum for the system efficiency, which is defined as . So basically my function would be something like , where x is a vector containing values for channel length, diameter, depth etc. Hopefully this is somewhat clear. fmincon, function, optimization MATLAB Answers — New Questions
Plot 2D electric field strength over distance (finite difference method)
Hello.
I am trying to 2D plot the electric field strength in kV/m over distance, like the figure below.
How do I do this?
My workspace is below, voltages are in a 181×301 matrix.Hello.
I am trying to 2D plot the electric field strength in kV/m over distance, like the figure below.
How do I do this?
My workspace is below, voltages are in a 181×301 matrix. Hello.
I am trying to 2D plot the electric field strength in kV/m over distance, like the figure below.
How do I do this?
My workspace is below, voltages are in a 181×301 matrix. fd, finite_methods, finite, finite_difference, electric, electric_power_engineering, plot, field_strength, kv/m MATLAB Answers — New Questions
802.11 DFS test signal
Hi,
Does Matlab have any 802.11 DFS test signal example?
Thanks.Hi,
Does Matlab have any 802.11 DFS test signal example?
Thanks. Hi,
Does Matlab have any 802.11 DFS test signal example?
Thanks. 802.11, dfs MATLAB Answers — New Questions
What’s the actual difference between versions ‘a’ and ‘b’ of MATLAB, other than being 6 months apart?
Hello guys.
I always thought the main difference between versions ‘a’ and ‘b’ of MATLAB was ‘b’ being 6 months "better" than version ‘a’ and, of course, this means that naturally the version ‘b’ is going to be a more up-to-date version, with more features as well – being the main intent to have new releases every semester. However, just the other day a friend of mine claimed something I wasn’t able to double-check elsewhere:
"Usually the ‘a’ versions are more stable (…) being ‘b’ more of a pre-release of version ‘a’ of the next year [rather than an actual release], having features that have past beta but still can be improved" (and supposedly will be improved and perfected at ‘a’). But isn’t this the story with just any release? Don’t you always implement new things and improve things of the past as necessary?
" ‘b’ will usually have more features than ‘a’, however the version ‘b’ is going to be something around 90% to 100% reliable, while ‘a’ will always be 100% reliable". Have someone ever come across these reliability concerns once?
(Writings in italic are my comments about the claims, and not part of the claim itself)
Is someone capable of confirming this? I have always seen it as if the real beta release/period takes place just months before the actual release of ‘a’ and ‘b’, when Mathworks releases its actual beta version to get feedback. Am I missing something?Hello guys.
I always thought the main difference between versions ‘a’ and ‘b’ of MATLAB was ‘b’ being 6 months "better" than version ‘a’ and, of course, this means that naturally the version ‘b’ is going to be a more up-to-date version, with more features as well – being the main intent to have new releases every semester. However, just the other day a friend of mine claimed something I wasn’t able to double-check elsewhere:
"Usually the ‘a’ versions are more stable (…) being ‘b’ more of a pre-release of version ‘a’ of the next year [rather than an actual release], having features that have past beta but still can be improved" (and supposedly will be improved and perfected at ‘a’). But isn’t this the story with just any release? Don’t you always implement new things and improve things of the past as necessary?
" ‘b’ will usually have more features than ‘a’, however the version ‘b’ is going to be something around 90% to 100% reliable, while ‘a’ will always be 100% reliable". Have someone ever come across these reliability concerns once?
(Writings in italic are my comments about the claims, and not part of the claim itself)
Is someone capable of confirming this? I have always seen it as if the real beta release/period takes place just months before the actual release of ‘a’ and ‘b’, when Mathworks releases its actual beta version to get feedback. Am I missing something? Hello guys.
I always thought the main difference between versions ‘a’ and ‘b’ of MATLAB was ‘b’ being 6 months "better" than version ‘a’ and, of course, this means that naturally the version ‘b’ is going to be a more up-to-date version, with more features as well – being the main intent to have new releases every semester. However, just the other day a friend of mine claimed something I wasn’t able to double-check elsewhere:
"Usually the ‘a’ versions are more stable (…) being ‘b’ more of a pre-release of version ‘a’ of the next year [rather than an actual release], having features that have past beta but still can be improved" (and supposedly will be improved and perfected at ‘a’). But isn’t this the story with just any release? Don’t you always implement new things and improve things of the past as necessary?
" ‘b’ will usually have more features than ‘a’, however the version ‘b’ is going to be something around 90% to 100% reliable, while ‘a’ will always be 100% reliable". Have someone ever come across these reliability concerns once?
(Writings in italic are my comments about the claims, and not part of the claim itself)
Is someone capable of confirming this? I have always seen it as if the real beta release/period takes place just months before the actual release of ‘a’ and ‘b’, when Mathworks releases its actual beta version to get feedback. Am I missing something? matlab, releases MATLAB Answers — New Questions
Where do I download support package files, with the following name convention: [name]_[release_[version].zip?
I am trying to install the Image Acquisition Toolbox Support Package for OS Generic Video Interface onto a computer with no internet connection. My issue is finding the correct file to install. When I download the support package on an internet-connected computer the folder is named osgenericvideointerface_download, but the 2014b support package installer does not recognize the folder as a support package folder. Instead, when I select the folder in the installer I receive the error,
% osgenericvideointerface_download does not contain any support package files.
% Specify a folder or subfolder that contains support package files.
% These files use the following name convention: [name]_[release_[version].zip
Where do I get the folder with this specified naming convention such that the installer will recognize it?
Thank youI am trying to install the Image Acquisition Toolbox Support Package for OS Generic Video Interface onto a computer with no internet connection. My issue is finding the correct file to install. When I download the support package on an internet-connected computer the folder is named osgenericvideointerface_download, but the 2014b support package installer does not recognize the folder as a support package folder. Instead, when I select the folder in the installer I receive the error,
% osgenericvideointerface_download does not contain any support package files.
% Specify a folder or subfolder that contains support package files.
% These files use the following name convention: [name]_[release_[version].zip
Where do I get the folder with this specified naming convention such that the installer will recognize it?
Thank you I am trying to install the Image Acquisition Toolbox Support Package for OS Generic Video Interface onto a computer with no internet connection. My issue is finding the correct file to install. When I download the support package on an internet-connected computer the folder is named osgenericvideointerface_download, but the 2014b support package installer does not recognize the folder as a support package folder. Instead, when I select the folder in the installer I receive the error,
% osgenericvideointerface_download does not contain any support package files.
% Specify a folder or subfolder that contains support package files.
% These files use the following name convention: [name]_[release_[version].zip
Where do I get the folder with this specified naming convention such that the installer will recognize it?
Thank you installation MATLAB Answers — New Questions
Does Matlab’s integral function pass the integration variable to the function handle one scalar at a time or as a vector?
Hello,
My integrand function contains a sum that depends on the integration variable, as follows:
tau = 1;
T = 20;
q = integral(@(t) f(t,tau),0,T)
function y = f(t,tau)
N = 0:floor(t,tau)
for i = 1:length(N)
n = N(i);
y = y + g(n,mod(t,tau) + (n+1)*tau) – g(n,mod(t,tau) + n*tau);
end
Where g is some function.
I’m not sure if the integral function is handling it correctly, because if it passes a vector t, the sum will not iterate over the correct range.
I would really appreciate any insights!
Thanks!Hello,
My integrand function contains a sum that depends on the integration variable, as follows:
tau = 1;
T = 20;
q = integral(@(t) f(t,tau),0,T)
function y = f(t,tau)
N = 0:floor(t,tau)
for i = 1:length(N)
n = N(i);
y = y + g(n,mod(t,tau) + (n+1)*tau) – g(n,mod(t,tau) + n*tau);
end
Where g is some function.
I’m not sure if the integral function is handling it correctly, because if it passes a vector t, the sum will not iterate over the correct range.
I would really appreciate any insights!
Thanks! Hello,
My integrand function contains a sum that depends on the integration variable, as follows:
tau = 1;
T = 20;
q = integral(@(t) f(t,tau),0,T)
function y = f(t,tau)
N = 0:floor(t,tau)
for i = 1:length(N)
n = N(i);
y = y + g(n,mod(t,tau) + (n+1)*tau) – g(n,mod(t,tau) + n*tau);
end
Where g is some function.
I’m not sure if the integral function is handling it correctly, because if it passes a vector t, the sum will not iterate over the correct range.
I would really appreciate any insights!
Thanks! integral MATLAB Answers — New Questions
Why MATLAB gui not giving the values of Phase 4. even i change the input values but sit giving NAN.
Why MATLAB gui not giving the values of Phase 4. even i change the input values but sit giving NAN.Why MATLAB gui not giving the values of Phase 4. even i change the input values but sit giving NAN. Why MATLAB gui not giving the values of Phase 4. even i change the input values but sit giving NAN. matlab gui MATLAB Answers — New Questions
Does the T obtained from the PoseCamera2 in stereo calibration translate Camera 2 in the coordinate system where Camera1’s optical center is the origin, or Camera2’s ?
I want to know the poses and positions of two cameras through stereo calibration. Therefore, I prepared Camera 1 and Camera 2, ran the stereocalibrator in the app, and outputted the result with Camera 1’s optical center as the origin. The results are shown in the first image and values ① and ②. On the other hand, using the same images, I outputted the result with Camera 2’s optical center as the origin, which are shown in the second image and values ③ and ④.
From the first image:
R=[0.745, -0.192, 0.637; 0.188, 0.979, 0.0761; -0.639, 0.0633, 0.766]…①
T=[-1828, -46.8, 57.3]…②
From the second image:
R=[0.745, 0.188, -0.639; -0.192, 0.979, 0.0633; 0.637, 0.0761, 0.766]…③
T=[1406, -311, 1129]…④
Here, I will show the relationship equation taught by a MATLAB staff member before. If the position of Camera 1 is [R1, t1; 0 1], the position of Camera 2 is [R2, t2; 0 1], and PoseCamera2 is [R, T; 0 1], then the following relationship holds.
R1 = R * R2…⑤
t1 = R * t2 + T…⑥
I will verify if ⑥ is satisfied using the first image and ②, but since Camera 2 is not moved to Camera 1, it does not satisfy the equation. Similarly, verifying with the second image and ④, it is also not a reasonable result. However, when verifying with the first image and ④, that is, if you move Camera 2 in the first image by ④ in the coordinate system where Camera 2’s optical center is the origin, Camera 2 moves to the location of Camera 1 in the image. Similarly, if you move Camera 2 in the second image by ②, it aligns with Camera 1.
Additionally, the number of image pairs used during stereo calibration was 30, and the reprojection error was 0.23 pixels from either image.I want to know the poses and positions of two cameras through stereo calibration. Therefore, I prepared Camera 1 and Camera 2, ran the stereocalibrator in the app, and outputted the result with Camera 1’s optical center as the origin. The results are shown in the first image and values ① and ②. On the other hand, using the same images, I outputted the result with Camera 2’s optical center as the origin, which are shown in the second image and values ③ and ④.
From the first image:
R=[0.745, -0.192, 0.637; 0.188, 0.979, 0.0761; -0.639, 0.0633, 0.766]…①
T=[-1828, -46.8, 57.3]…②
From the second image:
R=[0.745, 0.188, -0.639; -0.192, 0.979, 0.0633; 0.637, 0.0761, 0.766]…③
T=[1406, -311, 1129]…④
Here, I will show the relationship equation taught by a MATLAB staff member before. If the position of Camera 1 is [R1, t1; 0 1], the position of Camera 2 is [R2, t2; 0 1], and PoseCamera2 is [R, T; 0 1], then the following relationship holds.
R1 = R * R2…⑤
t1 = R * t2 + T…⑥
I will verify if ⑥ is satisfied using the first image and ②, but since Camera 2 is not moved to Camera 1, it does not satisfy the equation. Similarly, verifying with the second image and ④, it is also not a reasonable result. However, when verifying with the first image and ④, that is, if you move Camera 2 in the first image by ④ in the coordinate system where Camera 2’s optical center is the origin, Camera 2 moves to the location of Camera 1 in the image. Similarly, if you move Camera 2 in the second image by ②, it aligns with Camera 1.
Additionally, the number of image pairs used during stereo calibration was 30, and the reprojection error was 0.23 pixels from either image. I want to know the poses and positions of two cameras through stereo calibration. Therefore, I prepared Camera 1 and Camera 2, ran the stereocalibrator in the app, and outputted the result with Camera 1’s optical center as the origin. The results are shown in the first image and values ① and ②. On the other hand, using the same images, I outputted the result with Camera 2’s optical center as the origin, which are shown in the second image and values ③ and ④.
From the first image:
R=[0.745, -0.192, 0.637; 0.188, 0.979, 0.0761; -0.639, 0.0633, 0.766]…①
T=[-1828, -46.8, 57.3]…②
From the second image:
R=[0.745, 0.188, -0.639; -0.192, 0.979, 0.0633; 0.637, 0.0761, 0.766]…③
T=[1406, -311, 1129]…④
Here, I will show the relationship equation taught by a MATLAB staff member before. If the position of Camera 1 is [R1, t1; 0 1], the position of Camera 2 is [R2, t2; 0 1], and PoseCamera2 is [R, T; 0 1], then the following relationship holds.
R1 = R * R2…⑤
t1 = R * t2 + T…⑥
I will verify if ⑥ is satisfied using the first image and ②, but since Camera 2 is not moved to Camera 1, it does not satisfy the equation. Similarly, verifying with the second image and ④, it is also not a reasonable result. However, when verifying with the first image and ④, that is, if you move Camera 2 in the first image by ④ in the coordinate system where Camera 2’s optical center is the origin, Camera 2 moves to the location of Camera 1 in the image. Similarly, if you move Camera 2 in the second image by ②, it aligns with Camera 1.
Additionally, the number of image pairs used during stereo calibration was 30, and the reprojection error was 0.23 pixels from either image. stereocalibration, calibration, posecamera2, stereoparameters MATLAB Answers — New Questions
Make Timer in Simulink
Hello. I have 1 or 0 Signal coming as a input from my Ultrasonic Sensor. I want to make a Timer in simulink so that, if my input is 1 continuous for 5 seconds ,it gives me 1 at end, if not the timer starts again ,when 1 comes from the Sensor. I have Speed of Car and my distance. I wanted to integrate the distance to get time. Thankyou so much.Hello. I have 1 or 0 Signal coming as a input from my Ultrasonic Sensor. I want to make a Timer in simulink so that, if my input is 1 continuous for 5 seconds ,it gives me 1 at end, if not the timer starts again ,when 1 comes from the Sensor. I have Speed of Car and my distance. I wanted to integrate the distance to get time. Thankyou so much. Hello. I have 1 or 0 Signal coming as a input from my Ultrasonic Sensor. I want to make a Timer in simulink so that, if my input is 1 continuous for 5 seconds ,it gives me 1 at end, if not the timer starts again ,when 1 comes from the Sensor. I have Speed of Car and my distance. I wanted to integrate the distance to get time. Thankyou so much. simulink MATLAB Answers — New Questions
How to train ACF detector with groundTruthMultisignal object
I have labeled a data set of sonar images using the ground truth labler, and I want to use the lables in the trainACFObjectDetector function, to create a detector for further labeling. I used the ground truth labeler app because I can play a rgb video alongside the sonar feed, aiding with identifying objects in the sonar images. However the ground truth app producess a groundTruthMultisignal object, and I am unsure how to use this to train an ACF detector.
%% train acf detector
imds = sonar_files; % conatins path to each image
load("rec0gt.mat")
T = table(gTruth.ROILabelData.processed_sonar);
blds = boxLabelDatastore(T);
ds = combine(imds,blds);
acfDetector = trainACFObjectDetector(ds,NegativeSamplesFactor=2);I have labeled a data set of sonar images using the ground truth labler, and I want to use the lables in the trainACFObjectDetector function, to create a detector for further labeling. I used the ground truth labeler app because I can play a rgb video alongside the sonar feed, aiding with identifying objects in the sonar images. However the ground truth app producess a groundTruthMultisignal object, and I am unsure how to use this to train an ACF detector.
%% train acf detector
imds = sonar_files; % conatins path to each image
load("rec0gt.mat")
T = table(gTruth.ROILabelData.processed_sonar);
blds = boxLabelDatastore(T);
ds = combine(imds,blds);
acfDetector = trainACFObjectDetector(ds,NegativeSamplesFactor=2); I have labeled a data set of sonar images using the ground truth labler, and I want to use the lables in the trainACFObjectDetector function, to create a detector for further labeling. I used the ground truth labeler app because I can play a rgb video alongside the sonar feed, aiding with identifying objects in the sonar images. However the ground truth app producess a groundTruthMultisignal object, and I am unsure how to use this to train an ACF detector.
%% train acf detector
imds = sonar_files; % conatins path to each image
load("rec0gt.mat")
T = table(gTruth.ROILabelData.processed_sonar);
blds = boxLabelDatastore(T);
ds = combine(imds,blds);
acfDetector = trainACFObjectDetector(ds,NegativeSamplesFactor=2); acf detector, ground truth labeler app MATLAB Answers — New Questions
This function does not fully set the dimensions of output port 2
Hi, i am trying to write a design a fixed time disturbance observer for power estimation for a boost converter. But i keep getting this error: Error in default port dimensions function of S-function ‘boost_another_observer/MATLAB Function3’. This function does not fully set the dimensions of output port 2. Please help out 🙂
the code is as below:
function [sigma1_d,sigma2_d,sigma3_d,e1_est,d1_est,d1_d_est,d2_est,Pload_est] = observer(y2,e1,sigma1,sigma2,sigma3)
L1=8e3;
Ro=30;
Vcref=200;
C=1000e-6;
k1=0.5e3;
k2=0.5e3;
k3=3.5e4;
k4=3.5e4;
k5=50;
k6 = 50;
m1=0.8;
m2=0.6;
m3=0.4;
n1=1.2;
n2=1.4;
n3=1.6;
%% Observer design
sigma1_d=sigma2-k1*(abs(sigma1-e1)^m1)*sign(sigma1-e1)-k2*(abs(sigma1-e1)^n1)*sign(sigma1-e1)+y2;
sigma2_d=sigma3-k3*(abs(sigma1-e1)^m2)*sign(sigma1-e1)-k4*(abs(sigma1-e1)^n2)*sign(sigma1-e1);
sigma3_d=sigma3-k5*(abs(sigma1-e1)^m3)*sign(sigma1-e1)-k6*(abs(sigma1-e1)^n3)*sign(sigma1-e1);
%% Estimated values
e1_est=sigma1;
d1_est=sigma2;
d1_d_est=sigma3;
d2_est=-2*d1_est/(Ro*C);
Pload_est=-d1_est+Vcref^2/Ro-Vc^2/R+Vc^2/Ro;Hi, i am trying to write a design a fixed time disturbance observer for power estimation for a boost converter. But i keep getting this error: Error in default port dimensions function of S-function ‘boost_another_observer/MATLAB Function3’. This function does not fully set the dimensions of output port 2. Please help out 🙂
the code is as below:
function [sigma1_d,sigma2_d,sigma3_d,e1_est,d1_est,d1_d_est,d2_est,Pload_est] = observer(y2,e1,sigma1,sigma2,sigma3)
L1=8e3;
Ro=30;
Vcref=200;
C=1000e-6;
k1=0.5e3;
k2=0.5e3;
k3=3.5e4;
k4=3.5e4;
k5=50;
k6 = 50;
m1=0.8;
m2=0.6;
m3=0.4;
n1=1.2;
n2=1.4;
n3=1.6;
%% Observer design
sigma1_d=sigma2-k1*(abs(sigma1-e1)^m1)*sign(sigma1-e1)-k2*(abs(sigma1-e1)^n1)*sign(sigma1-e1)+y2;
sigma2_d=sigma3-k3*(abs(sigma1-e1)^m2)*sign(sigma1-e1)-k4*(abs(sigma1-e1)^n2)*sign(sigma1-e1);
sigma3_d=sigma3-k5*(abs(sigma1-e1)^m3)*sign(sigma1-e1)-k6*(abs(sigma1-e1)^n3)*sign(sigma1-e1);
%% Estimated values
e1_est=sigma1;
d1_est=sigma2;
d1_d_est=sigma3;
d2_est=-2*d1_est/(Ro*C);
Pload_est=-d1_est+Vcref^2/Ro-Vc^2/R+Vc^2/Ro; Hi, i am trying to write a design a fixed time disturbance observer for power estimation for a boost converter. But i keep getting this error: Error in default port dimensions function of S-function ‘boost_another_observer/MATLAB Function3’. This function does not fully set the dimensions of output port 2. Please help out 🙂
the code is as below:
function [sigma1_d,sigma2_d,sigma3_d,e1_est,d1_est,d1_d_est,d2_est,Pload_est] = observer(y2,e1,sigma1,sigma2,sigma3)
L1=8e3;
Ro=30;
Vcref=200;
C=1000e-6;
k1=0.5e3;
k2=0.5e3;
k3=3.5e4;
k4=3.5e4;
k5=50;
k6 = 50;
m1=0.8;
m2=0.6;
m3=0.4;
n1=1.2;
n2=1.4;
n3=1.6;
%% Observer design
sigma1_d=sigma2-k1*(abs(sigma1-e1)^m1)*sign(sigma1-e1)-k2*(abs(sigma1-e1)^n1)*sign(sigma1-e1)+y2;
sigma2_d=sigma3-k3*(abs(sigma1-e1)^m2)*sign(sigma1-e1)-k4*(abs(sigma1-e1)^n2)*sign(sigma1-e1);
sigma3_d=sigma3-k5*(abs(sigma1-e1)^m3)*sign(sigma1-e1)-k6*(abs(sigma1-e1)^n3)*sign(sigma1-e1);
%% Estimated values
e1_est=sigma1;
d1_est=sigma2;
d1_d_est=sigma3;
d2_est=-2*d1_est/(Ro*C);
Pload_est=-d1_est+Vcref^2/Ro-Vc^2/R+Vc^2/Ro; disturbance observer, simulink, matlab, sliding mode control, boost converter MATLAB Answers — New Questions
Why do I see the error message “unable to resolve this name ‘slcontrollib.internal.siginject.perturbationType.ADD'”
Why do I see the error message "unable to resolve this name ‘slcontrollib.internal.siginject.perturbationType.ADD’" in reduce order modeling using ROM app while run simulation in R2023b matlabWhy do I see the error message "unable to resolve this name ‘slcontrollib.internal.siginject.perturbationType.ADD’" in reduce order modeling using ROM app while run simulation in R2023b matlab Why do I see the error message "unable to resolve this name ‘slcontrollib.internal.siginject.perturbationType.ADD’" in reduce order modeling using ROM app while run simulation in R2023b matlab rom, simulation, ai MATLAB Answers — New Questions
Phased Array antenna design
Hello all,
I am designing one phased array antenna design for one of our product.
Currently I am designing array antenna with 12×8 array struture and subarray with 3×1 structure. So, we will be having 4 sub array on one row. That is 4 subarray with 3 elements i.e.total 12 vertical elements on one row and 8 horizontal elements.
I would like to perform array simulation with amplitude tapering and phase excitation with both dolph chebyshev and taylor window for one complete vertical elements i.e N= 12, with required side lobe level (SLL) as around 25dB
If we could get the amplitude tapering and phase excitation values , is it possible to optimize the tapering with proer ratio for each subarray because i need to design the power divider with 3X1 elements, however, the power ratio should be similar for all other sub arrays? Is it possible in the MATLAB?
Could you please help me to work with some examples specifically on the amplitude tapering and phase exitaions?
Is there any custumized Matlab scripted tool to design phased array antenna design with vertical and horizonatal steering?
Could you please give me the valuable support on this?Hello all,
I am designing one phased array antenna design for one of our product.
Currently I am designing array antenna with 12×8 array struture and subarray with 3×1 structure. So, we will be having 4 sub array on one row. That is 4 subarray with 3 elements i.e.total 12 vertical elements on one row and 8 horizontal elements.
I would like to perform array simulation with amplitude tapering and phase excitation with both dolph chebyshev and taylor window for one complete vertical elements i.e N= 12, with required side lobe level (SLL) as around 25dB
If we could get the amplitude tapering and phase excitation values , is it possible to optimize the tapering with proer ratio for each subarray because i need to design the power divider with 3X1 elements, however, the power ratio should be similar for all other sub arrays? Is it possible in the MATLAB?
Could you please help me to work with some examples specifically on the amplitude tapering and phase exitaions?
Is there any custumized Matlab scripted tool to design phased array antenna design with vertical and horizonatal steering?
Could you please give me the valuable support on this? Hello all,
I am designing one phased array antenna design for one of our product.
Currently I am designing array antenna with 12×8 array struture and subarray with 3×1 structure. So, we will be having 4 sub array on one row. That is 4 subarray with 3 elements i.e.total 12 vertical elements on one row and 8 horizontal elements.
I would like to perform array simulation with amplitude tapering and phase excitation with both dolph chebyshev and taylor window for one complete vertical elements i.e N= 12, with required side lobe level (SLL) as around 25dB
If we could get the amplitude tapering and phase excitation values , is it possible to optimize the tapering with proer ratio for each subarray because i need to design the power divider with 3X1 elements, however, the power ratio should be similar for all other sub arrays? Is it possible in the MATLAB?
Could you please help me to work with some examples specifically on the amplitude tapering and phase exitaions?
Is there any custumized Matlab scripted tool to design phased array antenna design with vertical and horizonatal steering?
Could you please give me the valuable support on this? phased array antenna, amplitude tapering for sub array, phase excitation MATLAB Answers — New Questions
Integrator does not accept input
Hello, I’m trying make a model in simulink of an inverted pendulum and I can’t simulate the space state. It’s still telling me about that the integrator does not accept the input. Does anyone know what do to in this situation?
The formula that I’m trying to simulate:
Simulation:
The error:
Matlab code:
%%Parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%%Matrice
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J]
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 0];
D = [0 0; 0 0;0 0;0 0];
%%Build system
sys = ss(A,B,C,D);
x0 = [5*pi/180;0;0;0]; %initial condition for the integratorHello, I’m trying make a model in simulink of an inverted pendulum and I can’t simulate the space state. It’s still telling me about that the integrator does not accept the input. Does anyone know what do to in this situation?
The formula that I’m trying to simulate:
Simulation:
The error:
Matlab code:
%%Parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%%Matrice
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J]
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 0];
D = [0 0; 0 0;0 0;0 0];
%%Build system
sys = ss(A,B,C,D);
x0 = [5*pi/180;0;0;0]; %initial condition for the integrator Hello, I’m trying make a model in simulink of an inverted pendulum and I can’t simulate the space state. It’s still telling me about that the integrator does not accept the input. Does anyone know what do to in this situation?
The formula that I’m trying to simulate:
Simulation:
The error:
Matlab code:
%%Parameters
Mp = 0.272;
dM = 0.071;
g = 9.81;
J = 0.002;
Jw = 3.941*10^-5;
b_theta = 0.82*10^-3;
b_altha_kmke_Ra = 1.202*10^-4;
km_Ra = 1.837*10^-4;
%%Matrice
A = [0 1 0 0;
(Mp*dM*g)/J -(b_theta)/J 0 1/J*b_altha_kmke_Ra;
0 0 0 1;
-(Mp*g*dM)/J b_theta/J 0 -(J+Jw)/(J*Jw)*b_altha_kmke_Ra];
B = [0 0;
-1/J*km_Ra 1/J;
0 0;
(J+Jw)/(J*Jw)*km_Ra -1/J]
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 0];
D = [0 0; 0 0;0 0;0 0];
%%Build system
sys = ss(A,B,C,D);
x0 = [5*pi/180;0;0;0]; %initial condition for the integrator simulink, equation MATLAB Answers — New Questions
How can I use multiple Simulation 3D Ultrasonic Sensor?
I have tried to simulated a parking scenario with Unreal Engine Environment. I want to attach multiple ultrasonic sensors to the vehicle. I attached one at the front bumper, 1 at the left and 1 at the right mirror.
However after the simulation, the ultrasonic sensors readings are always the same. Only the reading of the ultrasonic sensor attached to the right mirror is shown.
How can I get the readings from the other 2 sensors?I have tried to simulated a parking scenario with Unreal Engine Environment. I want to attach multiple ultrasonic sensors to the vehicle. I attached one at the front bumper, 1 at the left and 1 at the right mirror.
However after the simulation, the ultrasonic sensors readings are always the same. Only the reading of the ultrasonic sensor attached to the right mirror is shown.
How can I get the readings from the other 2 sensors? I have tried to simulated a parking scenario with Unreal Engine Environment. I want to attach multiple ultrasonic sensors to the vehicle. I attached one at the front bumper, 1 at the left and 1 at the right mirror.
However after the simulation, the ultrasonic sensors readings are always the same. Only the reading of the ultrasonic sensor attached to the right mirror is shown.
How can I get the readings from the other 2 sensors? automated driving toolbox, simulation 3d ultrasonic sensor MATLAB Answers — New Questions
Type mismatch error using SolidWorks’ API in MATLAB
Hello everyone,
I am experiencing hard time in trying to solve a problem when using the SolidWorks’ API in MATLAB. I want to use SolidWorks as CAD/CAE engine to be called iteratively by a MATLAB function for structural optimization.
I can get the access to the API by using the ‘actxsever’ instruction and use lots of API’s functionalities. However, there are some methods that I cannot use for two main reasons:
Type mismatch
When I try to use methods that require arguments related to errors or warnings. For example, when I want to use the OpenDoc6 method:
% Create a SolidWorks instance
swApp = actxserver(‘SldWorks.Application’);
% Set SolidWorks as visible
invoke(swApp,’Visible’, true);
% Set file path
filePath = "C:Pathtoyourfile.sldprt";
% Set arguments for OpenDoc6
swDocPART = 1;
swOpenDocOptions_Silent = 1;
% Arguments for error and warning
Errors = int32(0);
Warnings = int32(0);
% Open the document
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART, swOpenDocOptions_Silent, ”, Errors, Warnings);
I get the following error:
Error using COM.SldWorks_Application/invoke
Error: Type mismatch, argument 5
Error in prova_opendoc6 (line 19)
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART,swOpenDocOptions_Silent, ”, Errors, Warnings);
Looking on the API help about OpenDoc6 method, specifically the C++ syntax, I can see that Errors and Warnings are actually outputs: https://help.solidworks.com/2023/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isldworks~opendoc6.html
but I don’t understand how to manage this within MATLAB.
NULL or NOTHING
When there is the need of using the MATLAB equivalent of NULL or NOTHING. I tried with empty array [], empty string "", NaN, missing, etc. But none of them seems to work. For example, if I want to select something with SelectByID2:
myModelExt = invoke(myModel,’Extension’);
boolstatus = invoke(myModelExt,’SelectByID2′,"Boss-Extrude1", "SOLIDBODY", 0, 0, 0, true, 0, [], 0);
I get the error:
Error using Interface.SldWorks_Application_31.ActiveDoc.Extension/invoke
Error: Type mismatch, argument 8
for which argument 8 refers to the [ ] brackets. In the API help it is reported https://help.solidworks.com/2023/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~SelectByID2.html
but I have no idea how to manage the Callout argument.
I kindly ask you to help me to solve these difficulties. Maybe MATLAB’s possibilities to use the SolidWorks’ API are just limited and it is not possible using all the capabilities of the API, but I would like to hear about you before switching to other approaches.
Thank you very much.Hello everyone,
I am experiencing hard time in trying to solve a problem when using the SolidWorks’ API in MATLAB. I want to use SolidWorks as CAD/CAE engine to be called iteratively by a MATLAB function for structural optimization.
I can get the access to the API by using the ‘actxsever’ instruction and use lots of API’s functionalities. However, there are some methods that I cannot use for two main reasons:
Type mismatch
When I try to use methods that require arguments related to errors or warnings. For example, when I want to use the OpenDoc6 method:
% Create a SolidWorks instance
swApp = actxserver(‘SldWorks.Application’);
% Set SolidWorks as visible
invoke(swApp,’Visible’, true);
% Set file path
filePath = "C:Pathtoyourfile.sldprt";
% Set arguments for OpenDoc6
swDocPART = 1;
swOpenDocOptions_Silent = 1;
% Arguments for error and warning
Errors = int32(0);
Warnings = int32(0);
% Open the document
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART, swOpenDocOptions_Silent, ”, Errors, Warnings);
I get the following error:
Error using COM.SldWorks_Application/invoke
Error: Type mismatch, argument 5
Error in prova_opendoc6 (line 19)
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART,swOpenDocOptions_Silent, ”, Errors, Warnings);
Looking on the API help about OpenDoc6 method, specifically the C++ syntax, I can see that Errors and Warnings are actually outputs: https://help.solidworks.com/2023/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isldworks~opendoc6.html
but I don’t understand how to manage this within MATLAB.
NULL or NOTHING
When there is the need of using the MATLAB equivalent of NULL or NOTHING. I tried with empty array [], empty string "", NaN, missing, etc. But none of them seems to work. For example, if I want to select something with SelectByID2:
myModelExt = invoke(myModel,’Extension’);
boolstatus = invoke(myModelExt,’SelectByID2′,"Boss-Extrude1", "SOLIDBODY", 0, 0, 0, true, 0, [], 0);
I get the error:
Error using Interface.SldWorks_Application_31.ActiveDoc.Extension/invoke
Error: Type mismatch, argument 8
for which argument 8 refers to the [ ] brackets. In the API help it is reported https://help.solidworks.com/2023/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~SelectByID2.html
but I have no idea how to manage the Callout argument.
I kindly ask you to help me to solve these difficulties. Maybe MATLAB’s possibilities to use the SolidWorks’ API are just limited and it is not possible using all the capabilities of the API, but I would like to hear about you before switching to other approaches.
Thank you very much. Hello everyone,
I am experiencing hard time in trying to solve a problem when using the SolidWorks’ API in MATLAB. I want to use SolidWorks as CAD/CAE engine to be called iteratively by a MATLAB function for structural optimization.
I can get the access to the API by using the ‘actxsever’ instruction and use lots of API’s functionalities. However, there are some methods that I cannot use for two main reasons:
Type mismatch
When I try to use methods that require arguments related to errors or warnings. For example, when I want to use the OpenDoc6 method:
% Create a SolidWorks instance
swApp = actxserver(‘SldWorks.Application’);
% Set SolidWorks as visible
invoke(swApp,’Visible’, true);
% Set file path
filePath = "C:Pathtoyourfile.sldprt";
% Set arguments for OpenDoc6
swDocPART = 1;
swOpenDocOptions_Silent = 1;
% Arguments for error and warning
Errors = int32(0);
Warnings = int32(0);
% Open the document
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART, swOpenDocOptions_Silent, ”, Errors, Warnings);
I get the following error:
Error using COM.SldWorks_Application/invoke
Error: Type mismatch, argument 5
Error in prova_opendoc6 (line 19)
PartDoc = invoke(swApp, ‘OpenDoc6’, filePath, swDocPART,swOpenDocOptions_Silent, ”, Errors, Warnings);
Looking on the API help about OpenDoc6 method, specifically the C++ syntax, I can see that Errors and Warnings are actually outputs: https://help.solidworks.com/2023/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isldworks~opendoc6.html
but I don’t understand how to manage this within MATLAB.
NULL or NOTHING
When there is the need of using the MATLAB equivalent of NULL or NOTHING. I tried with empty array [], empty string "", NaN, missing, etc. But none of them seems to work. For example, if I want to select something with SelectByID2:
myModelExt = invoke(myModel,’Extension’);
boolstatus = invoke(myModelExt,’SelectByID2′,"Boss-Extrude1", "SOLIDBODY", 0, 0, 0, true, 0, [], 0);
I get the error:
Error using Interface.SldWorks_Application_31.ActiveDoc.Extension/invoke
Error: Type mismatch, argument 8
for which argument 8 refers to the [ ] brackets. In the API help it is reported https://help.solidworks.com/2023/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.IModelDocExtension~SelectByID2.html
but I have no idea how to manage the Callout argument.
I kindly ask you to help me to solve these difficulties. Maybe MATLAB’s possibilities to use the SolidWorks’ API are just limited and it is not possible using all the capabilities of the API, but I would like to hear about you before switching to other approaches.
Thank you very much. api, actxserver, com, solidworks MATLAB Answers — New Questions