Category: Matlab
Category Archives: Matlab
PowerGUI and Rapid Accelerator: A new block names […] cannot be added
I built an electrical simulation in Simulink using Simscape Specialized Technology with fixed-step simulations. The powergui block is in the main system. When I want to run the simulation in Rapid Accelerator mode, it compiles successfully with MSVC++. At the stage "Connect to Rapid Accelerator Process and Simulate" it outputs:
A new block named ‘MainSimulation/powergui/EquivalentModel19’ cannot be added
How can I get past that and/or further understand the problem?
(The ultimate goal is to deploy this as a Desktop app, so Rapid Accelerator mode is required)I built an electrical simulation in Simulink using Simscape Specialized Technology with fixed-step simulations. The powergui block is in the main system. When I want to run the simulation in Rapid Accelerator mode, it compiles successfully with MSVC++. At the stage "Connect to Rapid Accelerator Process and Simulate" it outputs:
A new block named ‘MainSimulation/powergui/EquivalentModel19’ cannot be added
How can I get past that and/or further understand the problem?
(The ultimate goal is to deploy this as a Desktop app, so Rapid Accelerator mode is required) I built an electrical simulation in Simulink using Simscape Specialized Technology with fixed-step simulations. The powergui block is in the main system. When I want to run the simulation in Rapid Accelerator mode, it compiles successfully with MSVC++. At the stage "Connect to Rapid Accelerator Process and Simulate" it outputs:
A new block named ‘MainSimulation/powergui/EquivalentModel19’ cannot be added
How can I get past that and/or further understand the problem?
(The ultimate goal is to deploy this as a Desktop app, so Rapid Accelerator mode is required) powergui, rapid accelerator MATLAB Answers — New Questions
How to show a figure in the MATLAB App designer with both X and Y axis from signal in simulink real-time model?
How can we customize the x-axis of the instrumented axes in MATLAB App (with model running on Speedgoat)? I wanted to plot Speed vs Torque (signals from Simulink model) (in the axes) instead of separately plotting them with respect to time.How can we customize the x-axis of the instrumented axes in MATLAB App (with model running on Speedgoat)? I wanted to plot Speed vs Torque (signals from Simulink model) (in the axes) instead of separately plotting them with respect to time. How can we customize the x-axis of the instrumented axes in MATLAB App (with model running on Speedgoat)? I wanted to plot Speed vs Torque (signals from Simulink model) (in the axes) instead of separately plotting them with respect to time. simulink, appdesigner MATLAB Answers — New Questions
Memory efficient alternative for meshgrid?
I am generating a meshgrid to be able to calculate my result fast:
% x, y, z are some large vectors
[a,b,c] = meshgrid(x,y,z);
% s, t are constants, M some matrix
result = (((c*s – b*t).^2)./(a.^2 + b.^2 + c.^2)).*M;
This is actually working quite nicely. Unfortunately, for very large x,y,z, the meshgrid function is running out of memory.
How do I rewrite the meshgrid function to be memory efficient?
I had thought of three loops like this:
result = zeros(length(x), length(y), length(z));
for i = 1:lenght(x)-1
for j = y = 1:lenght(y)-1
for k = z = 1:lenght(z)-1
b = ??
c = ??
result(i,j,k) = (((c*s – b*t).^2)./(x(i)^2 + y(j)^2 + z(k).^2));
end
end
end
result = result.*M;
What are the values for b and c?
How can I turn the outer for into a parfor?I am generating a meshgrid to be able to calculate my result fast:
% x, y, z are some large vectors
[a,b,c] = meshgrid(x,y,z);
% s, t are constants, M some matrix
result = (((c*s – b*t).^2)./(a.^2 + b.^2 + c.^2)).*M;
This is actually working quite nicely. Unfortunately, for very large x,y,z, the meshgrid function is running out of memory.
How do I rewrite the meshgrid function to be memory efficient?
I had thought of three loops like this:
result = zeros(length(x), length(y), length(z));
for i = 1:lenght(x)-1
for j = y = 1:lenght(y)-1
for k = z = 1:lenght(z)-1
b = ??
c = ??
result(i,j,k) = (((c*s – b*t).^2)./(x(i)^2 + y(j)^2 + z(k).^2));
end
end
end
result = result.*M;
What are the values for b and c?
How can I turn the outer for into a parfor? I am generating a meshgrid to be able to calculate my result fast:
% x, y, z are some large vectors
[a,b,c] = meshgrid(x,y,z);
% s, t are constants, M some matrix
result = (((c*s – b*t).^2)./(a.^2 + b.^2 + c.^2)).*M;
This is actually working quite nicely. Unfortunately, for very large x,y,z, the meshgrid function is running out of memory.
How do I rewrite the meshgrid function to be memory efficient?
I had thought of three loops like this:
result = zeros(length(x), length(y), length(z));
for i = 1:lenght(x)-1
for j = y = 1:lenght(y)-1
for k = z = 1:lenght(z)-1
b = ??
c = ??
result(i,j,k) = (((c*s – b*t).^2)./(x(i)^2 + y(j)^2 + z(k).^2));
end
end
end
result = result.*M;
What are the values for b and c?
How can I turn the outer for into a parfor? meshgrid, parfor MATLAB Answers — New Questions
Can I input an array of derivatives to the integrator and obtain an array as output?
I am new to Simulink/Matlab. I have a 2-element array of time-derivatives as input to a Simulink integrator block and I want to get a corresponding array as output. Is this even admissible? If so, how do I specify the dimensions of the inputs and outputs to the integrator block?
I get the following error when I try to build the model.
Error in port widths or dimensions. Invalid dimension has been specified for ‘Input Port 1’ of ‘<foo>/Integrator’. I have seen some people ask similar questions
Thanks.I am new to Simulink/Matlab. I have a 2-element array of time-derivatives as input to a Simulink integrator block and I want to get a corresponding array as output. Is this even admissible? If so, how do I specify the dimensions of the inputs and outputs to the integrator block?
I get the following error when I try to build the model.
Error in port widths or dimensions. Invalid dimension has been specified for ‘Input Port 1’ of ‘<foo>/Integrator’. I have seen some people ask similar questions
Thanks. I am new to Simulink/Matlab. I have a 2-element array of time-derivatives as input to a Simulink integrator block and I want to get a corresponding array as output. Is this even admissible? If so, how do I specify the dimensions of the inputs and outputs to the integrator block?
I get the following error when I try to build the model.
Error in port widths or dimensions. Invalid dimension has been specified for ‘Input Port 1’ of ‘<foo>/Integrator’. I have seen some people ask similar questions
Thanks. array input to integrator MATLAB Answers — New Questions
Integral and inverse integral
Hi,
I would like to calculate the probability of failure using the convolution therom as described in this paper https://www.researchgate.net/publication/314278481_Reliability_Index_for_Non-normal_Distribution_of_Limit_State_Functions
First I wanted to write the code using examples of this paper (Please look at the attached screenshots). Unfortunately, I didn’t get the same results. I found a probabilty of failure Pf=3.82 10^-08 instead of 5.55 10^-02.
In addition, I am struggling to write the inverse function to derive the reliabilty index. I always leads to errors?
Can anyone explain the mistake?
Sigma= 1;
Mu=5;
PDF_Norm=@(x) exp(-0.5.*((x-Mu)/Sigma).^2)/(Sigma*sqrt(2*pi));
a=2;
b=1;
Gamma=@(x) x.^(a-1).*exp(-x/b)/((b^a).*gamma(a));
FUN=@(x) PDF_Norm(x).*Gamma(-x);
Pf=integral(@(x) FUN(x),-Inf,0);
sym x
Beta=finverse(F,x);Hi,
I would like to calculate the probability of failure using the convolution therom as described in this paper https://www.researchgate.net/publication/314278481_Reliability_Index_for_Non-normal_Distribution_of_Limit_State_Functions
First I wanted to write the code using examples of this paper (Please look at the attached screenshots). Unfortunately, I didn’t get the same results. I found a probabilty of failure Pf=3.82 10^-08 instead of 5.55 10^-02.
In addition, I am struggling to write the inverse function to derive the reliabilty index. I always leads to errors?
Can anyone explain the mistake?
Sigma= 1;
Mu=5;
PDF_Norm=@(x) exp(-0.5.*((x-Mu)/Sigma).^2)/(Sigma*sqrt(2*pi));
a=2;
b=1;
Gamma=@(x) x.^(a-1).*exp(-x/b)/((b^a).*gamma(a));
FUN=@(x) PDF_Norm(x).*Gamma(-x);
Pf=integral(@(x) FUN(x),-Inf,0);
sym x
Beta=finverse(F,x); Hi,
I would like to calculate the probability of failure using the convolution therom as described in this paper https://www.researchgate.net/publication/314278481_Reliability_Index_for_Non-normal_Distribution_of_Limit_State_Functions
First I wanted to write the code using examples of this paper (Please look at the attached screenshots). Unfortunately, I didn’t get the same results. I found a probabilty of failure Pf=3.82 10^-08 instead of 5.55 10^-02.
In addition, I am struggling to write the inverse function to derive the reliabilty index. I always leads to errors?
Can anyone explain the mistake?
Sigma= 1;
Mu=5;
PDF_Norm=@(x) exp(-0.5.*((x-Mu)/Sigma).^2)/(Sigma*sqrt(2*pi));
a=2;
b=1;
Gamma=@(x) x.^(a-1).*exp(-x/b)/((b^a).*gamma(a));
FUN=@(x) PDF_Norm(x).*Gamma(-x);
Pf=integral(@(x) FUN(x),-Inf,0);
sym x
Beta=finverse(F,x); integral, convolution MATLAB Answers — New Questions
Bug in saving .fig (but not .png or .pdf) from when specifiying YAxis.Exponent as -6
In my livescript (MATLAB R2023b), I programatically save some of my plots via saveas(). I’m currently saving as a .pdf, a .png, and a .fig.
When I first specify that that the plot should have a YAxis exponent of -6 (it defaults to -5), my plots look as expected in the produced/displayed MATLAB .fig, and in the saved .pdf and .png. BUT…when I open the saved .fig, it shows an exponent of 10^2147483647. Not 10^-6 as everything else does.
I’ve been able to reproduce this in a .m file as well, so it doesn’t seem to be related to the .mlx.
This is how I’m saving the plots:
set(gcf, ‘visible’, ‘on’); % have to do this bc livescripts sets off, but then the figs open as invisible later
saveas(gcf,plotFullFilename,’fig’)
saveas(gcf,plotFullFilename,’png’)
exportgraphics(gcf,allPlotsFilename,’append’,true)
This is how I set the exponent:
axA.YAxis.Exponent = -6;
axB.YAxis.Exponent = -6;
If I comment out the exponent code and let it default to a yaxis exponent to -5, then the .fig saves with an exponent of -5.
But I don’t want a y-axis exponent of -5. I want it in engineering notation, e.g. an exponent of -6. This looks like a bug to me. Any ideas?In my livescript (MATLAB R2023b), I programatically save some of my plots via saveas(). I’m currently saving as a .pdf, a .png, and a .fig.
When I first specify that that the plot should have a YAxis exponent of -6 (it defaults to -5), my plots look as expected in the produced/displayed MATLAB .fig, and in the saved .pdf and .png. BUT…when I open the saved .fig, it shows an exponent of 10^2147483647. Not 10^-6 as everything else does.
I’ve been able to reproduce this in a .m file as well, so it doesn’t seem to be related to the .mlx.
This is how I’m saving the plots:
set(gcf, ‘visible’, ‘on’); % have to do this bc livescripts sets off, but then the figs open as invisible later
saveas(gcf,plotFullFilename,’fig’)
saveas(gcf,plotFullFilename,’png’)
exportgraphics(gcf,allPlotsFilename,’append’,true)
This is how I set the exponent:
axA.YAxis.Exponent = -6;
axB.YAxis.Exponent = -6;
If I comment out the exponent code and let it default to a yaxis exponent to -5, then the .fig saves with an exponent of -5.
But I don’t want a y-axis exponent of -5. I want it in engineering notation, e.g. an exponent of -6. This looks like a bug to me. Any ideas? In my livescript (MATLAB R2023b), I programatically save some of my plots via saveas(). I’m currently saving as a .pdf, a .png, and a .fig.
When I first specify that that the plot should have a YAxis exponent of -6 (it defaults to -5), my plots look as expected in the produced/displayed MATLAB .fig, and in the saved .pdf and .png. BUT…when I open the saved .fig, it shows an exponent of 10^2147483647. Not 10^-6 as everything else does.
I’ve been able to reproduce this in a .m file as well, so it doesn’t seem to be related to the .mlx.
This is how I’m saving the plots:
set(gcf, ‘visible’, ‘on’); % have to do this bc livescripts sets off, but then the figs open as invisible later
saveas(gcf,plotFullFilename,’fig’)
saveas(gcf,plotFullFilename,’png’)
exportgraphics(gcf,allPlotsFilename,’append’,true)
This is how I set the exponent:
axA.YAxis.Exponent = -6;
axB.YAxis.Exponent = -6;
If I comment out the exponent code and let it default to a yaxis exponent to -5, then the .fig saves with an exponent of -5.
But I don’t want a y-axis exponent of -5. I want it in engineering notation, e.g. an exponent of -6. This looks like a bug to me. Any ideas? saveas, save figure, livescript, bug, exponent MATLAB Answers — New Questions
Custom mask Simscape blocks
I created a custom simscape library with my own blocks using .ssc files. After compiling, Matlab generates a mask. However, I am only be able to add controls of type popup and edit (in the parameters section of the .ssc file). However, I would like to add different controls such as a link and table. As far as I know, this is not possible using the .ssc file, correct?
The idea is to create a custom mask on top of the "MATLAB" mask. I want to do this programmatically by "copying" the parameters of the MATLAB mask to the custom mask and add more controls. Is this possible?
If yes, should I do this with a sl_postprocess.m file for every block? I would appreciate an example.I created a custom simscape library with my own blocks using .ssc files. After compiling, Matlab generates a mask. However, I am only be able to add controls of type popup and edit (in the parameters section of the .ssc file). However, I would like to add different controls such as a link and table. As far as I know, this is not possible using the .ssc file, correct?
The idea is to create a custom mask on top of the "MATLAB" mask. I want to do this programmatically by "copying" the parameters of the MATLAB mask to the custom mask and add more controls. Is this possible?
If yes, should I do this with a sl_postprocess.m file for every block? I would appreciate an example. I created a custom simscape library with my own blocks using .ssc files. After compiling, Matlab generates a mask. However, I am only be able to add controls of type popup and edit (in the parameters section of the .ssc file). However, I would like to add different controls such as a link and table. As far as I know, this is not possible using the .ssc file, correct?
The idea is to create a custom mask on top of the "MATLAB" mask. I want to do this programmatically by "copying" the parameters of the MATLAB mask to the custom mask and add more controls. Is this possible?
If yes, should I do this with a sl_postprocess.m file for every block? I would appreciate an example. simscape MATLAB Answers — New Questions
conedisk problem using bvp4c
conedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.2;
A4 = 1.1;
A5 = 1.1;
A6 = 1.1;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = -12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 1;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 0 Rew g3 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
, for the above code i want the graph for F,G as what i have attached in jpg…but I am unable to get the graph.Please help me where do I have to make the changes. Thanks in advance.conedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.2;
A4 = 1.1;
A5 = 1.1;
A6 = 1.1;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = -12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 1;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 0 Rew g3 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
, for the above code i want the graph for F,G as what i have attached in jpg…but I am unable to get the graph.Please help me where do I have to make the changes. Thanks in advance. conedisk2()
function conedisk2
% Parameter values
A1 = 1.10629;
A2 = 1.15;
A3 = 1.2;
A4 = 1.1;
A5 = 1.1;
A6 = 1.1;
M = 0.2;
Grt = 5;
Pr = 0.71;
R = 0.2;
Ec = 0.1;
Q = 0.1;
Rew = 12;
Red = -12;
n = -1;
g1 = 0;
g2 = 0;
g3 = 0;
g4 = 0;
inf = 1;
% Set solver options to increase the maximum number of mesh points
options = bvpset(‘RelTol’, 1e-5, ‘AbsTol’, 1e-7, ‘NMax’, 5000);
% Defining parameters
solinit = bvpinit(linspace(0, 1, 200), [0 g1 g2 0 Rew g3 1 g4]);
sol = bvp4c(@bvp2D, @bc2D, solinit);
x = sol.x;
y = sol.y;
% Plotting of the velocity
figure(1)
plot(x, y(1,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘F(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of G
figure(2)
plot(x, y(5,:), ‘linewidth’, 1)
hold on
xlabel(‘eta ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘G(eta) ‘, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Plotting of theta
figure(3)
plot(x, y(7,:), ‘linewidth’, 1)
hold on
xlabel(‘eta’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
ylabel(‘theta(eta)’, ‘fontweight’, ‘bold’, ‘fontsize’, 16)
hold off
% Residual of the boundary conditions
function res = bc2D(y0, yinf)
res = [y0(1);yinf(1); y0(4); yinf(4);y0(5)-Rew; yinf(5)-Red;y0(7)-1; yinf(7)];
end
% System of First Order ODEs
function dydx = bvp2D(eta, y)
yy1 = (-(1+eta^2)*((10*A1*eta+A2*eta*y(1)-A2*y(4))*y(3))-3*(2*A1+7*A1*(eta^2)+A2*(2*eta^2+1)*y(1)-A2*eta*y(4))*y(2)-2*A2*y(5)*y(6)-3*(A1+A2*y(1))*y(4)+A3*M*y(2)-A4*Grt*y(8))/(A1*(1+eta^2)^2);
yy2 = eta*y(2);
yy3 = (-3*A1*eta*y(6)-A2*(eta*y(1)-y(4))*y(6)+A3*M*y(5))/(A1*(eta^2+1));
yy4 = ((A5+4/3*R)*((eta*((2*n)-1))*y(8)+n^2*y(7))-A3*Pr*M*Ec*(y(1)^2+y(5)^2)-Pr*Q*y(7)+A6*Pr*(y(4)*y(8)+n*y(1)*y(7)-eta*y(1)*y(8)))/(A5+4/3*R)*(1+eta^2);
dydx = [y(2); y(3); yy1; yy2; y(6); yy3; y(8); yy4];
end
end
, for the above code i want the graph for F,G as what i have attached in jpg…but I am unable to get the graph.Please help me where do I have to make the changes. Thanks in advance. graph for f and g MATLAB Answers — New Questions
How to extract and open Json file in folder.
Dear All,
I have Json file in folder as attached. But, I tried to extract and open, it failed.
Some can help me?Dear All,
I have Json file in folder as attached. But, I tried to extract and open, it failed.
Some can help me? Dear All,
I have Json file in folder as attached. But, I tried to extract and open, it failed.
Some can help me? image analysis, image processing, digital image processing, image segmentation, image acquisition, image, data, database, data import MATLAB Answers — New Questions
Unable to start simulation at condition specified using IC block.
I have built a model to simulate acceleration and top speed of a vehicle. I want to specify the initial engine RPM as 3500 for which I have added IC Block specifying the same. But even then Engine RPM is 0 at the start. How can I start my simulation when the engine speed is 3500 RPM?I have built a model to simulate acceleration and top speed of a vehicle. I want to specify the initial engine RPM as 3500 for which I have added IC Block specifying the same. But even then Engine RPM is 0 at the start. How can I start my simulation when the engine speed is 3500 RPM? I have built a model to simulate acceleration and top speed of a vehicle. I want to specify the initial engine RPM as 3500 for which I have added IC Block specifying the same. But even then Engine RPM is 0 at the start. How can I start my simulation when the engine speed is 3500 RPM? vehicle, vehicle performance, initial condition, ic block MATLAB Answers — New Questions
In ecap module how does capture event selection works?
I want to mesure position of Bldc motor using hall sensor for FOC.As a refrence model I am using mcb_pmsm_foc_hall_f280049c.slx.How does capture event selection works? Below are the image of event slection block of 3 hall sensor.I want to mesure position of Bldc motor using hall sensor for FOC.As a refrence model I am using mcb_pmsm_foc_hall_f280049c.slx.How does capture event selection works? Below are the image of event slection block of 3 hall sensor. I want to mesure position of Bldc motor using hall sensor for FOC.As a refrence model I am using mcb_pmsm_foc_hall_f280049c.slx.How does capture event selection works? Below are the image of event slection block of 3 hall sensor. hall sensor, field oriented control, ecap, f280049c MATLAB Answers — New Questions
How to change baud rate for STM32 F769I-Discovery in Simulink for PiL-Simulation?
Hi guys,
for a PIL-Simulation with serial connection (USB), I want to change the PIL baud rate for an STM32 F769I-Discovery:
I tried to change the PIL baud rate to e.g. 1000000 Bd. After I compiled my model, it doesn’t run with my desired baud rate and it returned an error. When I left the baud rate to 115200 Bd (default), Simulink compiled my model and ran it with 115200Bd.
Is there an error or why can’t I change the baud rate for a STM32-F769I Discovery although there is an option to change the baud rate (see picture above)?
Greetings
RLHi guys,
for a PIL-Simulation with serial connection (USB), I want to change the PIL baud rate for an STM32 F769I-Discovery:
I tried to change the PIL baud rate to e.g. 1000000 Bd. After I compiled my model, it doesn’t run with my desired baud rate and it returned an error. When I left the baud rate to 115200 Bd (default), Simulink compiled my model and ran it with 115200Bd.
Is there an error or why can’t I change the baud rate for a STM32-F769I Discovery although there is an option to change the baud rate (see picture above)?
Greetings
RL Hi guys,
for a PIL-Simulation with serial connection (USB), I want to change the PIL baud rate for an STM32 F769I-Discovery:
I tried to change the PIL baud rate to e.g. 1000000 Bd. After I compiled my model, it doesn’t run with my desired baud rate and it returned an error. When I left the baud rate to 115200 Bd (default), Simulink compiled my model and ran it with 115200Bd.
Is there an error or why can’t I change the baud rate for a STM32-F769I Discovery although there is an option to change the baud rate (see picture above)?
Greetings
RL stm32microcontroller, baud rate, processor-in-the-loop simulation, pil, simulink, stm32-f769i discovery MATLAB Answers — New Questions
How to change the x-axis step size?
I have this code, everything is fine but I tried to change x-axis step size in order to be 1 instead of 0.5, but it didn’t work!
clear;
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
set ( gca, ‘xdir’, ‘reverse’ )
yyaxis left
stairs(SF,TOA,’-.’)
title(‘Distance <—-‘)
xlabel(‘SF’)
ylabel(‘TOA (msec)’)
yyaxis right
stairs(SF,R_b,’r’)
ylabel(‘Data Rate (kbps)’)
legend(‘TOA’,’Data Rate’)
gridI have this code, everything is fine but I tried to change x-axis step size in order to be 1 instead of 0.5, but it didn’t work!
clear;
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
set ( gca, ‘xdir’, ‘reverse’ )
yyaxis left
stairs(SF,TOA,’-.’)
title(‘Distance <—-‘)
xlabel(‘SF’)
ylabel(‘TOA (msec)’)
yyaxis right
stairs(SF,R_b,’r’)
ylabel(‘Data Rate (kbps)’)
legend(‘TOA’,’Data Rate’)
grid I have this code, everything is fine but I tried to change x-axis step size in order to be 1 instead of 0.5, but it didn’t work!
clear;
SF=[12 11 10 9 8 7];
TOA=[1318.91 741.38 370.69 185.34 102.91 56.58];
R_b=[0.29 0.54 0.98 1.76 3.12 5.47];
%Plotting
set ( gca, ‘xdir’, ‘reverse’ )
yyaxis left
stairs(SF,TOA,’-.’)
title(‘Distance <—-‘)
xlabel(‘SF’)
ylabel(‘TOA (msec)’)
yyaxis right
stairs(SF,R_b,’r’)
ylabel(‘Data Rate (kbps)’)
legend(‘TOA’,’Data Rate’)
grid x-axis, step-size MATLAB Answers — New Questions
Permission denied error when trying to remove Matlab on Ubuntu computer
Hi, I tried to remove Matlab on Ubuntu 18.04 computer using [root@localhost ~] rm -rf /usr/local/MATLAB/R2021b command but all I get is an error saying permission denied. What is the way around this?Hi, I tried to remove Matlab on Ubuntu 18.04 computer using [root@localhost ~] rm -rf /usr/local/MATLAB/R2021b command but all I get is an error saying permission denied. What is the way around this? Hi, I tried to remove Matlab on Ubuntu 18.04 computer using [root@localhost ~] rm -rf /usr/local/MATLAB/R2021b command but all I get is an error saying permission denied. What is the way around this? permission, uninstall MATLAB Answers — New Questions
IN matlab 2017b version i have a error in canny edge detection like this.
Segmentedimg = edge(Enhanceimg,’canny’); figure(‘Name’,’Segmented image’,’NumberTitle’,’off’); imshow(Segmentedimg);
title(‘Segmented Image’,’fontsize’,10,’fontname’,’Times New Roman’,’color’,’Black’);Segmentedimg = edge(Enhanceimg,’canny’); figure(‘Name’,’Segmented image’,’NumberTitle’,’off’); imshow(Segmentedimg);
title(‘Segmented Image’,’fontsize’,10,’fontname’,’Times New Roman’,’color’,’Black’); Segmentedimg = edge(Enhanceimg,’canny’); figure(‘Name’,’Segmented image’,’NumberTitle’,’off’); imshow(Segmentedimg);
title(‘Segmented Image’,’fontsize’,10,’fontname’,’Times New Roman’,’color’,’Black’); canny, sobel MATLAB Answers — New Questions
Auto complete inputs of method using object property
Hey,
I have a class with a property that I would like to use for auto completion:
classdef TestClass
properties
Names
end
methods
function self = TestClass(names)
arguments
names (1,:) string
end
self.Names = names;
end
function printName(self, name)
mustBeMember(name, self.Names)
disp(name)
end
end
end
So when I call the method ‘printName’, I would like matlab so suggest the possible options, i.e. the elements of the property ‘Names’.
How can I do that?Hey,
I have a class with a property that I would like to use for auto completion:
classdef TestClass
properties
Names
end
methods
function self = TestClass(names)
arguments
names (1,:) string
end
self.Names = names;
end
function printName(self, name)
mustBeMember(name, self.Names)
disp(name)
end
end
end
So when I call the method ‘printName’, I would like matlab so suggest the possible options, i.e. the elements of the property ‘Names’.
How can I do that? Hey,
I have a class with a property that I would like to use for auto completion:
classdef TestClass
properties
Names
end
methods
function self = TestClass(names)
arguments
names (1,:) string
end
self.Names = names;
end
function printName(self, name)
mustBeMember(name, self.Names)
disp(name)
end
end
end
So when I call the method ‘printName’, I would like matlab so suggest the possible options, i.e. the elements of the property ‘Names’.
How can I do that? oop, class MATLAB Answers — New Questions
TI OMAP-L138. Acquiring data into MATLAB
Good night
I am a student, working on a DSP project. I need to acquire data from a TI OMAP-L138 LCDK output into matlab workspace for further processing. I was able to do that by connecting the OMAP output to the PC mic analog input and use the sound card. However, it only worked for higher frequency ranges. My project involves work with low frequencies and the microphone cannon pick such signals up.
I have watched several tutorials and found that it is possible to acquire signals into matlab from tecktronic function generators, connected through USB or RS232. However, an instrument driver for this generator already exists in Matlab. Any chance someone can help me to find a driver that would work for OMAP-L138?
Thank youGood night
I am a student, working on a DSP project. I need to acquire data from a TI OMAP-L138 LCDK output into matlab workspace for further processing. I was able to do that by connecting the OMAP output to the PC mic analog input and use the sound card. However, it only worked for higher frequency ranges. My project involves work with low frequencies and the microphone cannon pick such signals up.
I have watched several tutorials and found that it is possible to acquire signals into matlab from tecktronic function generators, connected through USB or RS232. However, an instrument driver for this generator already exists in Matlab. Any chance someone can help me to find a driver that would work for OMAP-L138?
Thank you Good night
I am a student, working on a DSP project. I need to acquire data from a TI OMAP-L138 LCDK output into matlab workspace for further processing. I was able to do that by connecting the OMAP output to the PC mic analog input and use the sound card. However, it only worked for higher frequency ranges. My project involves work with low frequencies and the microphone cannon pick such signals up.
I have watched several tutorials and found that it is possible to acquire signals into matlab from tecktronic function generators, connected through USB or RS232. However, an instrument driver for this generator already exists in Matlab. Any chance someone can help me to find a driver that would work for OMAP-L138?
Thank you omap-l138 lcdk, dsp, microphone MATLAB Answers — New Questions
Real time module TCP communication cannot receive the correct signal through the command line
I use the TCP communication module in Real Time, but before sending signals, I must package them into uint8 type signals. "I want to receive these signals in the form of a command line and convert them to the original double type. I have tried using double () to coerce the type conversion, but the im2double () function has failed to obtain the original signal correctly.". Is there any way to obtain it?
t=tcpclient(‘192.168.7.1’,8001);
while(1)
data=read(t,8);
write(t,data);
u=double(data);
endI use the TCP communication module in Real Time, but before sending signals, I must package them into uint8 type signals. "I want to receive these signals in the form of a command line and convert them to the original double type. I have tried using double () to coerce the type conversion, but the im2double () function has failed to obtain the original signal correctly.". Is there any way to obtain it?
t=tcpclient(‘192.168.7.1’,8001);
while(1)
data=read(t,8);
write(t,data);
u=double(data);
end I use the TCP communication module in Real Time, but before sending signals, I must package them into uint8 type signals. "I want to receive these signals in the form of a command line and convert them to the original double type. I have tried using double () to coerce the type conversion, but the im2double () function has failed to obtain the original signal correctly.". Is there any way to obtain it?
t=tcpclient(‘192.168.7.1’,8001);
while(1)
data=read(t,8);
write(t,data);
u=double(data);
end real time, tcp, pack MATLAB Answers — New Questions
Can I use webwrite to make a PUT request?
I’ve been able to successfully use the ‘webwrite’ and ‘webread’ functions for POST and GET requests for REST API calls in Matlab. Now, I need to make a small PUT request without any body/data.
Is there a way to use webwrite for this purpose? I’ve read about the matlab.net.HTTP.Request Class in THIS page, but it seems complicated – how do I send a BEARER authorization token and the PUT request without any body/data? It would be nice if webwrite could handle PUT requests as well.
Thanks,
PVI’ve been able to successfully use the ‘webwrite’ and ‘webread’ functions for POST and GET requests for REST API calls in Matlab. Now, I need to make a small PUT request without any body/data.
Is there a way to use webwrite for this purpose? I’ve read about the matlab.net.HTTP.Request Class in THIS page, but it seems complicated – how do I send a BEARER authorization token and the PUT request without any body/data? It would be nice if webwrite could handle PUT requests as well.
Thanks,
PV I’ve been able to successfully use the ‘webwrite’ and ‘webread’ functions for POST and GET requests for REST API calls in Matlab. Now, I need to make a small PUT request without any body/data.
Is there a way to use webwrite for this purpose? I’ve read about the matlab.net.HTTP.Request Class in THIS page, but it seems complicated – how do I send a BEARER authorization token and the PUT request without any body/data? It would be nice if webwrite could handle PUT requests as well.
Thanks,
PV rest, webwrite, webread, put request MATLAB Answers — New Questions
What does “Interrupt while evaluating Button PrivateButtonPushedFcn.” mean?
My program was working but now I’m getting this.
Interrupt while evaluating Button PrivateButtonPushedFcn.
If I knew more about the error maybe I coud fix it. There is no help looking up this error in MatLab help. Googled but got trivial problems others had had.My program was working but now I’m getting this.
Interrupt while evaluating Button PrivateButtonPushedFcn.
If I knew more about the error maybe I coud fix it. There is no help looking up this error in MatLab help. Googled but got trivial problems others had had. My program was working but now I’m getting this.
Interrupt while evaluating Button PrivateButtonPushedFcn.
If I knew more about the error maybe I coud fix it. There is no help looking up this error in MatLab help. Googled but got trivial problems others had had. error message unclear MATLAB Answers — New Questions