Category: Matlab
Category Archives: Matlab
Incomplete plot of an integral function
Hi,
I’m having a problem plotting an integal function. Basically, the graph comes out incomplete. Am I doing something wrong or is there a more efficient way to plot the intgral of function (f)? I’ve attached the graph I’m getting and the code I’m using. Your help is greatly appreciated.
syms t X Y;
d=0.5;
f= 121864 *(exp(-2*(((X-(-d*cos(628*t)+7*t)).^2) + ((Y-(d*sin(628*t))).^2))/0.0002)) ;
Z =int(f,t,0,0.4);
fsurf(Z,[-0.1 1.22 -0.61 0.61],’EdgeColor’,’none’);
view([0,90]);
colormap jet;
colorbar;
ax = gca;
ax.FontSize = 24;
xlabel(‘X(mm)’)
ylabel(‘Y(mm)’)
zlabel(‘E=J/mm^2’)Hi,
I’m having a problem plotting an integal function. Basically, the graph comes out incomplete. Am I doing something wrong or is there a more efficient way to plot the intgral of function (f)? I’ve attached the graph I’m getting and the code I’m using. Your help is greatly appreciated.
syms t X Y;
d=0.5;
f= 121864 *(exp(-2*(((X-(-d*cos(628*t)+7*t)).^2) + ((Y-(d*sin(628*t))).^2))/0.0002)) ;
Z =int(f,t,0,0.4);
fsurf(Z,[-0.1 1.22 -0.61 0.61],’EdgeColor’,’none’);
view([0,90]);
colormap jet;
colorbar;
ax = gca;
ax.FontSize = 24;
xlabel(‘X(mm)’)
ylabel(‘Y(mm)’)
zlabel(‘E=J/mm^2’) Hi,
I’m having a problem plotting an integal function. Basically, the graph comes out incomplete. Am I doing something wrong or is there a more efficient way to plot the intgral of function (f)? I’ve attached the graph I’m getting and the code I’m using. Your help is greatly appreciated.
syms t X Y;
d=0.5;
f= 121864 *(exp(-2*(((X-(-d*cos(628*t)+7*t)).^2) + ((Y-(d*sin(628*t))).^2))/0.0002)) ;
Z =int(f,t,0,0.4);
fsurf(Z,[-0.1 1.22 -0.61 0.61],’EdgeColor’,’none’);
view([0,90]);
colormap jet;
colorbar;
ax = gca;
ax.FontSize = 24;
xlabel(‘X(mm)’)
ylabel(‘Y(mm)’)
zlabel(‘E=J/mm^2’) integral, integration, plotting, 3d plots MATLAB Answers — New Questions
Can I create a new serial port on the Arduino Uno to run a Simulink model in real time that also uses a serial port?
I’m attempting to run the example MODBUS RS485 Communication Between Client and Server Using Arduino Board with two Arduino Uno units. These units have only one dedicated serial port on pins 0 and 1. When I go to Monitor and Tune the Client Model, I get an error message for all 6 MODBUS blocks in the model that reads:
Error evaluating ‘InitFcn’ callback of codertarget.arduinobase.internal.arduino_ModbusRS485MasterRead block (mask) ‘arduino_modbus_client/Modbus RS485 Client Read’.
Callback string is ‘codertarget.arduinobase.conflictcheck.validateandregisterBlocks(gcbh);’
Caused by:
The SerialPin_1 ‘1’ being used by ‘arduino_modbus_client/Modbus RS485 Client Read’ is currently in use by ‘Monitor and tune over XCP on Serial’. To resolve the conflict, change the value of SerialPin_1 in ‘arduino_modbus_client/Modbus RS485 Client Read’ to an alternate valid value.
It appears that the only port the Arduino Uno has is in use by the USB interface with my desktop computer. I know that ArduinoIDE has the SoftwareSerial library addon that is supposed to allow you to assign pins to create a separate serial port, but I don’t know if a similar operation is possible in Simulink. Or perhaps I can create the new port in ArduinoIDE for use in the Simulink model. Thank you.I’m attempting to run the example MODBUS RS485 Communication Between Client and Server Using Arduino Board with two Arduino Uno units. These units have only one dedicated serial port on pins 0 and 1. When I go to Monitor and Tune the Client Model, I get an error message for all 6 MODBUS blocks in the model that reads:
Error evaluating ‘InitFcn’ callback of codertarget.arduinobase.internal.arduino_ModbusRS485MasterRead block (mask) ‘arduino_modbus_client/Modbus RS485 Client Read’.
Callback string is ‘codertarget.arduinobase.conflictcheck.validateandregisterBlocks(gcbh);’
Caused by:
The SerialPin_1 ‘1’ being used by ‘arduino_modbus_client/Modbus RS485 Client Read’ is currently in use by ‘Monitor and tune over XCP on Serial’. To resolve the conflict, change the value of SerialPin_1 in ‘arduino_modbus_client/Modbus RS485 Client Read’ to an alternate valid value.
It appears that the only port the Arduino Uno has is in use by the USB interface with my desktop computer. I know that ArduinoIDE has the SoftwareSerial library addon that is supposed to allow you to assign pins to create a separate serial port, but I don’t know if a similar operation is possible in Simulink. Or perhaps I can create the new port in ArduinoIDE for use in the Simulink model. Thank you. I’m attempting to run the example MODBUS RS485 Communication Between Client and Server Using Arduino Board with two Arduino Uno units. These units have only one dedicated serial port on pins 0 and 1. When I go to Monitor and Tune the Client Model, I get an error message for all 6 MODBUS blocks in the model that reads:
Error evaluating ‘InitFcn’ callback of codertarget.arduinobase.internal.arduino_ModbusRS485MasterRead block (mask) ‘arduino_modbus_client/Modbus RS485 Client Read’.
Callback string is ‘codertarget.arduinobase.conflictcheck.validateandregisterBlocks(gcbh);’
Caused by:
The SerialPin_1 ‘1’ being used by ‘arduino_modbus_client/Modbus RS485 Client Read’ is currently in use by ‘Monitor and tune over XCP on Serial’. To resolve the conflict, change the value of SerialPin_1 in ‘arduino_modbus_client/Modbus RS485 Client Read’ to an alternate valid value.
It appears that the only port the Arduino Uno has is in use by the USB interface with my desktop computer. I know that ArduinoIDE has the SoftwareSerial library addon that is supposed to allow you to assign pins to create a separate serial port, but I don’t know if a similar operation is possible in Simulink. Or perhaps I can create the new port in ArduinoIDE for use in the Simulink model. Thank you. arduino, serial, communication MATLAB Answers — New Questions
Automated controls project DC motor controlcre
Automated controls project DC motor control
1..Mathimathical Model of the system
2. Simulink model of the DC Motor(simulink file)
3. Root locus diagram using matlab
4. Intrducing of PID controlel
5. System response before and after adding the PID controller
6. ConclusionAutomated controls project DC motor control
1..Mathimathical Model of the system
2. Simulink model of the DC Motor(simulink file)
3. Root locus diagram using matlab
4. Intrducing of PID controlel
5. System response before and after adding the PID controller
6. Conclusion Automated controls project DC motor control
1..Mathimathical Model of the system
2. Simulink model of the DC Motor(simulink file)
3. Root locus diagram using matlab
4. Intrducing of PID controlel
5. System response before and after adding the PID controller
6. Conclusion create code MATLAB Answers — New Questions
Serial Receive in Desktop Real-Time Kernel Mode
I am trying to get an input from a serial input in Simulink Desktop Real-Time.
To do so I have a "Serial Configuration" block and a "Serial Receive" block which is connected to a "To Workspace" block. (see screenshot below)
I am able to run the model in "Conneceted IO Mode". However, if I change the mode to "Kernel Mode", the model does not work anymore. Simulink states:
Serial Failed Code genreation inofrmation file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 19.781s
Error(s) encountered while building "Serial_Read"
Is it possible to use serial inputs in "Kernel Mode"? If yes, how can I avoid getting this error?I am trying to get an input from a serial input in Simulink Desktop Real-Time.
To do so I have a "Serial Configuration" block and a "Serial Receive" block which is connected to a "To Workspace" block. (see screenshot below)
I am able to run the model in "Conneceted IO Mode". However, if I change the mode to "Kernel Mode", the model does not work anymore. Simulink states:
Serial Failed Code genreation inofrmation file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 19.781s
Error(s) encountered while building "Serial_Read"
Is it possible to use serial inputs in "Kernel Mode"? If yes, how can I avoid getting this error? I am trying to get an input from a serial input in Simulink Desktop Real-Time.
To do so I have a "Serial Configuration" block and a "Serial Receive" block which is connected to a "To Workspace" block. (see screenshot below)
I am able to run the model in "Conneceted IO Mode". However, if I change the mode to "Kernel Mode", the model does not work anymore. Simulink states:
Serial Failed Code genreation inofrmation file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 19.781s
Error(s) encountered while building "Serial_Read"
Is it possible to use serial inputs in "Kernel Mode"? If yes, how can I avoid getting this error? simulink, real-time, kernel mode, serial, serial receive MATLAB Answers — New Questions
writestruct() fails to write empty child element to XML file
I need to write a empty, nested element within an XML file. An XML example of what I’d like to achieve is:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB>
<child/>
</elementB>
</Problem>
The nested element in this case is called "child". I expected the following MATLAB code to produce this result:
s.elementA = 14;
s.elementB.child = [];
writestruct(s,’test.xml’,’StructNodeName’,’Problem’)
However, this generates the following XML, whereupon the "child" element is entirely missing:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB/>
</Problem>
How can I produce a result with an empty, nested element?I need to write a empty, nested element within an XML file. An XML example of what I’d like to achieve is:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB>
<child/>
</elementB>
</Problem>
The nested element in this case is called "child". I expected the following MATLAB code to produce this result:
s.elementA = 14;
s.elementB.child = [];
writestruct(s,’test.xml’,’StructNodeName’,’Problem’)
However, this generates the following XML, whereupon the "child" element is entirely missing:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB/>
</Problem>
How can I produce a result with an empty, nested element? I need to write a empty, nested element within an XML file. An XML example of what I’d like to achieve is:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB>
<child/>
</elementB>
</Problem>
The nested element in this case is called "child". I expected the following MATLAB code to produce this result:
s.elementA = 14;
s.elementB.child = [];
writestruct(s,’test.xml’,’StructNodeName’,’Problem’)
However, this generates the following XML, whereupon the "child" element is entirely missing:
<?xml version="1.0" encoding="UTF-8"?>
<Problem>
<elementA>14</elementA>
<elementB/>
</Problem>
How can I produce a result with an empty, nested element? writestruct, xml, structures MATLAB Answers — New Questions
How to solve non_linear equation
Post Content Post Content @staff MATLAB Answers — New Questions
How can I color the specific region of the image?
Hi!
I want to change the color of specific region in an image. The background color should be different from the eyes color of the image shown below. Thanks
img = imread(‘C:UsersJunaid KhanDesktopjun.png’);
bn=im2bw(img);
imshow(bn)
bn=bwareaopen(bn,100);
imshow(bn)
[L,n]=bwlabel(bn);
imshow(label2rgb(L));
prop=regionprops(L);
The above is the input image and while I run this code the output is like this.
I want to change the eyes and mouth color and also the background color should not be same.
ThanksHi!
I want to change the color of specific region in an image. The background color should be different from the eyes color of the image shown below. Thanks
img = imread(‘C:UsersJunaid KhanDesktopjun.png’);
bn=im2bw(img);
imshow(bn)
bn=bwareaopen(bn,100);
imshow(bn)
[L,n]=bwlabel(bn);
imshow(label2rgb(L));
prop=regionprops(L);
The above is the input image and while I run this code the output is like this.
I want to change the eyes and mouth color and also the background color should not be same.
Thanks Hi!
I want to change the color of specific region in an image. The background color should be different from the eyes color of the image shown below. Thanks
img = imread(‘C:UsersJunaid KhanDesktopjun.png’);
bn=im2bw(img);
imshow(bn)
bn=bwareaopen(bn,100);
imshow(bn)
[L,n]=bwlabel(bn);
imshow(label2rgb(L));
prop=regionprops(L);
The above is the input image and while I run this code the output is like this.
I want to change the eyes and mouth color and also the background color should not be same.
Thanks image processing MATLAB Answers — New Questions
PID control action for AC reference of variable amplitude and frequency.
i have seen example of controlling output dc voltage of DC to DC buck converter using PID controller. I want to implement DC to AC converter. I tried using PID controller. Since i am comparing output AC signal(continuously varying) with reference sinusoidal signal, PID controller is not providing expected output. In case of DC to DC, both reference signal was constant. In my case, it is continuously varying sine wave. Can anyone suggest any way to get accurate DC to AC conversion? i changed kp and ki parameters to get needed response. it is working well. but, when i change frequency of input reference signal, output signal amplitude drops and again i have to change PID parameters.
P.S. when i change frequency of input reference signal, again i have to change PID gain parameters. Can PID controller work with continuously varying reference signal(in terms of amplitude and frequency both) ?i have seen example of controlling output dc voltage of DC to DC buck converter using PID controller. I want to implement DC to AC converter. I tried using PID controller. Since i am comparing output AC signal(continuously varying) with reference sinusoidal signal, PID controller is not providing expected output. In case of DC to DC, both reference signal was constant. In my case, it is continuously varying sine wave. Can anyone suggest any way to get accurate DC to AC conversion? i changed kp and ki parameters to get needed response. it is working well. but, when i change frequency of input reference signal, output signal amplitude drops and again i have to change PID parameters.
P.S. when i change frequency of input reference signal, again i have to change PID gain parameters. Can PID controller work with continuously varying reference signal(in terms of amplitude and frequency both) ? i have seen example of controlling output dc voltage of DC to DC buck converter using PID controller. I want to implement DC to AC converter. I tried using PID controller. Since i am comparing output AC signal(continuously varying) with reference sinusoidal signal, PID controller is not providing expected output. In case of DC to DC, both reference signal was constant. In my case, it is continuously varying sine wave. Can anyone suggest any way to get accurate DC to AC conversion? i changed kp and ki parameters to get needed response. it is working well. but, when i change frequency of input reference signal, output signal amplitude drops and again i have to change PID parameters.
P.S. when i change frequency of input reference signal, again i have to change PID gain parameters. Can PID controller work with continuously varying reference signal(in terms of amplitude and frequency both) ? simulink MATLAB Answers — New Questions
Pseudo-terminal will not be allocated because stdin is not a terminal.
When trying to ssh to linux device form matlab scirpts, i get these messages as in screenshot, any thoughts why this can happen and how can we get terminal?When trying to ssh to linux device form matlab scirpts, i get these messages as in screenshot, any thoughts why this can happen and how can we get terminal? When trying to ssh to linux device form matlab scirpts, i get these messages as in screenshot, any thoughts why this can happen and how can we get terminal? matlab MATLAB Answers — New Questions
NLP problem with fmincon: Non-differentiable point in objective function
Consider the simplified optimisation problem having as decision variable the vector:
where is the number of discretisation points, multiplied by the number of variables per point (e.g. 6 state variables and 3 control variables).
Let the objective function be defined such that the control effort is minimised:
Where is the number of discretisation points and is the 3×1 control vector at the i-th time instant.
In code notation, this becomes:
%% Example:
% Problem data:
timeInstants = 10;
stateVariables = 6;
controlVariables = 3;
allVariables = stateVariables + controlVariables;
decisionVariables = allVariables*timeInstants;
% Indeces:
idx = reshape(1:decisionVariables,allVariables,[])’;
controlIdx = idx(:,1:controlVariables)’;
% NLP vector:
x = rand(1,decisionVariables);
% Objective function:
f = sum(vecnorm(x(controlIdx)));
From literature, I know that the optimal solution of my problem is bang-bang, i.e.:
The analytical Jacobian and Hessian are defined as:
Considering the control profile I’m looking for, the convergence is affected by the singularity when , where both Jacobian and Hessian become indeterminate.
I tried to overcome the problem by imposing alternatives forms when the NaN occurs (such as ones or zeros), but considering that the zero solution is optimal, this causes convergence failures.
The same problem occurs with numerical derivatives.
How can I overcome this problem?
Do you have any reference about other people facing this issue?
Thanks in advance.Consider the simplified optimisation problem having as decision variable the vector:
where is the number of discretisation points, multiplied by the number of variables per point (e.g. 6 state variables and 3 control variables).
Let the objective function be defined such that the control effort is minimised:
Where is the number of discretisation points and is the 3×1 control vector at the i-th time instant.
In code notation, this becomes:
%% Example:
% Problem data:
timeInstants = 10;
stateVariables = 6;
controlVariables = 3;
allVariables = stateVariables + controlVariables;
decisionVariables = allVariables*timeInstants;
% Indeces:
idx = reshape(1:decisionVariables,allVariables,[])’;
controlIdx = idx(:,1:controlVariables)’;
% NLP vector:
x = rand(1,decisionVariables);
% Objective function:
f = sum(vecnorm(x(controlIdx)));
From literature, I know that the optimal solution of my problem is bang-bang, i.e.:
The analytical Jacobian and Hessian are defined as:
Considering the control profile I’m looking for, the convergence is affected by the singularity when , where both Jacobian and Hessian become indeterminate.
I tried to overcome the problem by imposing alternatives forms when the NaN occurs (such as ones or zeros), but considering that the zero solution is optimal, this causes convergence failures.
The same problem occurs with numerical derivatives.
How can I overcome this problem?
Do you have any reference about other people facing this issue?
Thanks in advance. Consider the simplified optimisation problem having as decision variable the vector:
where is the number of discretisation points, multiplied by the number of variables per point (e.g. 6 state variables and 3 control variables).
Let the objective function be defined such that the control effort is minimised:
Where is the number of discretisation points and is the 3×1 control vector at the i-th time instant.
In code notation, this becomes:
%% Example:
% Problem data:
timeInstants = 10;
stateVariables = 6;
controlVariables = 3;
allVariables = stateVariables + controlVariables;
decisionVariables = allVariables*timeInstants;
% Indeces:
idx = reshape(1:decisionVariables,allVariables,[])’;
controlIdx = idx(:,1:controlVariables)’;
% NLP vector:
x = rand(1,decisionVariables);
% Objective function:
f = sum(vecnorm(x(controlIdx)));
From literature, I know that the optimal solution of my problem is bang-bang, i.e.:
The analytical Jacobian and Hessian are defined as:
Considering the control profile I’m looking for, the convergence is affected by the singularity when , where both Jacobian and Hessian become indeterminate.
I tried to overcome the problem by imposing alternatives forms when the NaN occurs (such as ones or zeros), but considering that the zero solution is optimal, this causes convergence failures.
The same problem occurs with numerical derivatives.
How can I overcome this problem?
Do you have any reference about other people facing this issue?
Thanks in advance. nlp, fmincon, hessian, jacobian, indeterminate, nondifferentiable, analytical MATLAB Answers — New Questions
how retrive last data not nan from Thingspeak channel in matlab
I want in my project when retrive data from Thingspeak channel and if data is nan then retrive last data not nan in matlabI want in my project when retrive data from Thingspeak channel and if data is nan then retrive last data not nan in matlab I want in my project when retrive data from Thingspeak channel and if data is nan then retrive last data not nan in matlab matlab, programming MATLAB Answers — New Questions
How to evaluate what satellites is passing above the ground station at a specific time.
Hi,
I am trying to find out what satellites are passing about a ground station at any given time. For this I have following the documentaion and examples for satellite scenario.
I am generating the satellites from the publically available starlink TLE file database at celestrak.
By observing the elevation on (https://satellitemap.space/?constellation=starlink#), I decided to use 75 as min elevation.
Below is the code that gives a list of satellites that passes over the ground station as "intvls".
But the below metod is missing out some satellites that should have been detected. More than likely it is due to the min elevation angle but reducing it increases the false positive.
Any help and suggestions are appreciated appreciated.
Thank you
startTime = datetime(2024,6,11,13,43,00); %TIME IS IN UTC
stopTime = startTime + minutes(30);
sampleTime = 2; % seconds
sc = satelliteScenario(startTime,stopTime,sampleTime);
lat = 30.240997424571656;
lon = -81.61860217874788;
minElevationAngle = 75; %based on observation
gs = groundStation(sc,lat,lon,"MinElevationAngle",minElevationAngle);
sat = satellite(sc, "All_sat.tle");
% play(sc)
ac = access(sat,gs);
intvls = accessIntervals(ac);
% time = datetime(2024,6,11,13,44,0);
% s = accessStatus(ac,time);Hi,
I am trying to find out what satellites are passing about a ground station at any given time. For this I have following the documentaion and examples for satellite scenario.
I am generating the satellites from the publically available starlink TLE file database at celestrak.
By observing the elevation on (https://satellitemap.space/?constellation=starlink#), I decided to use 75 as min elevation.
Below is the code that gives a list of satellites that passes over the ground station as "intvls".
But the below metod is missing out some satellites that should have been detected. More than likely it is due to the min elevation angle but reducing it increases the false positive.
Any help and suggestions are appreciated appreciated.
Thank you
startTime = datetime(2024,6,11,13,43,00); %TIME IS IN UTC
stopTime = startTime + minutes(30);
sampleTime = 2; % seconds
sc = satelliteScenario(startTime,stopTime,sampleTime);
lat = 30.240997424571656;
lon = -81.61860217874788;
minElevationAngle = 75; %based on observation
gs = groundStation(sc,lat,lon,"MinElevationAngle",minElevationAngle);
sat = satellite(sc, "All_sat.tle");
% play(sc)
ac = access(sat,gs);
intvls = accessIntervals(ac);
% time = datetime(2024,6,11,13,44,0);
% s = accessStatus(ac,time); Hi,
I am trying to find out what satellites are passing about a ground station at any given time. For this I have following the documentaion and examples for satellite scenario.
I am generating the satellites from the publically available starlink TLE file database at celestrak.
By observing the elevation on (https://satellitemap.space/?constellation=starlink#), I decided to use 75 as min elevation.
Below is the code that gives a list of satellites that passes over the ground station as "intvls".
But the below metod is missing out some satellites that should have been detected. More than likely it is due to the min elevation angle but reducing it increases the false positive.
Any help and suggestions are appreciated appreciated.
Thank you
startTime = datetime(2024,6,11,13,43,00); %TIME IS IN UTC
stopTime = startTime + minutes(30);
sampleTime = 2; % seconds
sc = satelliteScenario(startTime,stopTime,sampleTime);
lat = 30.240997424571656;
lon = -81.61860217874788;
minElevationAngle = 75; %based on observation
gs = groundStation(sc,lat,lon,"MinElevationAngle",minElevationAngle);
sat = satellite(sc, "All_sat.tle");
% play(sc)
ac = access(sat,gs);
intvls = accessIntervals(ac);
% time = datetime(2024,6,11,13,44,0);
% s = accessStatus(ac,time); matlab, communication, satellite MATLAB Answers — New Questions
How do I get rid of the “lollypop” output on a Simulink Simulation Data Inspector plot?
All of my SimEvents output in the Simulation Data Inspector plots look like a bunch of lollypops. What I really want are just the circles, or maybe curve, not the vertical lines. How can I change the output to the desired format? I am using MATLAB 2024a Update 3.
Is the lollypop display a SimEvents artifact?
Figure 1 – The Lollypops
I also notice that my Time Plot Visualization settings are limited to just the following, not the full set of options shown in the Help Center documentation. How do I access the additional Time Plot Visualization settings?
Figure 2 – My Time Plot Visualization Settings
Figure 3 – Visualization Settings Shown in Help Center DocumentationAll of my SimEvents output in the Simulation Data Inspector plots look like a bunch of lollypops. What I really want are just the circles, or maybe curve, not the vertical lines. How can I change the output to the desired format? I am using MATLAB 2024a Update 3.
Is the lollypop display a SimEvents artifact?
Figure 1 – The Lollypops
I also notice that my Time Plot Visualization settings are limited to just the following, not the full set of options shown in the Help Center documentation. How do I access the additional Time Plot Visualization settings?
Figure 2 – My Time Plot Visualization Settings
Figure 3 – Visualization Settings Shown in Help Center Documentation All of my SimEvents output in the Simulation Data Inspector plots look like a bunch of lollypops. What I really want are just the circles, or maybe curve, not the vertical lines. How can I change the output to the desired format? I am using MATLAB 2024a Update 3.
Is the lollypop display a SimEvents artifact?
Figure 1 – The Lollypops
I also notice that my Time Plot Visualization settings are limited to just the following, not the full set of options shown in the Help Center documentation. How do I access the additional Time Plot Visualization settings?
Figure 2 – My Time Plot Visualization Settings
Figure 3 – Visualization Settings Shown in Help Center Documentation simevents, simulation data inspector, visualization settings MATLAB Answers — New Questions
Convert cycles per degree to sigma in imgaussfilt
Hello,
I am trying to filter my images to a certain cycles per degree (cpd). I have obtained the visual angle of the image, and I would like to low-pass filter my images to under 1 cpd using a Gaussian filter. However, I couldn’t figure out what sigma I should use in the imgaussfilt function. Is there a direct formula for the conversion?
I was looking at a similar question here, where we first calculate the visual angle, but it does not mention how it relates to the second formula to obtain sigma. Additionally, there is a constant k in the formula, but I am not sure how to determine what is an appropriate k to use. I would appreciate any help. Thank you!Hello,
I am trying to filter my images to a certain cycles per degree (cpd). I have obtained the visual angle of the image, and I would like to low-pass filter my images to under 1 cpd using a Gaussian filter. However, I couldn’t figure out what sigma I should use in the imgaussfilt function. Is there a direct formula for the conversion?
I was looking at a similar question here, where we first calculate the visual angle, but it does not mention how it relates to the second formula to obtain sigma. Additionally, there is a constant k in the formula, but I am not sure how to determine what is an appropriate k to use. I would appreciate any help. Thank you! Hello,
I am trying to filter my images to a certain cycles per degree (cpd). I have obtained the visual angle of the image, and I would like to low-pass filter my images to under 1 cpd using a Gaussian filter. However, I couldn’t figure out what sigma I should use in the imgaussfilt function. Is there a direct formula for the conversion?
I was looking at a similar question here, where we first calculate the visual angle, but it does not mention how it relates to the second formula to obtain sigma. Additionally, there is a constant k in the formula, but I am not sure how to determine what is an appropriate k to use. I would appreciate any help. Thank you! spatial frequency, image processing, imgaussfilt, gaussian MATLAB Answers — New Questions
Assistance Required for Sending Data to ThingSpeak Using SIM7600G-H
Hello,
I am experiencing issues while trying to send data to ThingSpeak using a SIM7600G-H module connected to my Arduino. Despite following the standard procedure, I consistently receive a 400 Bad Request error from the server.
Here is the sequence of AT commands I am using:
AT+CGDCONT=1,"IP","vzwinternet" OK AT+CGATT=1 OK AT+CGACT=1,1 OK
AT+NETOPEN OK +NETOPEN: 0 AT+CIPOPEN=0,"TCP","api.thingspeak.com",80 OK +CIPOPEN: 0,0
POST /update HTTP/1.1rn Host: api.thingspeak.comrn Connection: closern Content-Type: application/x-www-form-urlencodedrn Content-Length: 43rnrn api_key=jejeje&field1=80:30:habierta:apagadorn
<html> <head><title>400 Bad Request</title></head> <body> <center><h1>400 Bad Request</h1></center> </body> </html>
I have verified that the Content-Length is correct and that all the required headers are included.
Could anyone provide insights or suggestions on what might be causing this issue? Any help would be greatly appreciated.
Thank you!Hello,
I am experiencing issues while trying to send data to ThingSpeak using a SIM7600G-H module connected to my Arduino. Despite following the standard procedure, I consistently receive a 400 Bad Request error from the server.
Here is the sequence of AT commands I am using:
AT+CGDCONT=1,"IP","vzwinternet" OK AT+CGATT=1 OK AT+CGACT=1,1 OK
AT+NETOPEN OK +NETOPEN: 0 AT+CIPOPEN=0,"TCP","api.thingspeak.com",80 OK +CIPOPEN: 0,0
POST /update HTTP/1.1rn Host: api.thingspeak.comrn Connection: closern Content-Type: application/x-www-form-urlencodedrn Content-Length: 43rnrn api_key=jejeje&field1=80:30:habierta:apagadorn
<html> <head><title>400 Bad Request</title></head> <body> <center><h1>400 Bad Request</h1></center> </body> </html>
I have verified that the Content-Length is correct and that all the required headers are included.
Could anyone provide insights or suggestions on what might be causing this issue? Any help would be greatly appreciated.
Thank you! Hello,
I am experiencing issues while trying to send data to ThingSpeak using a SIM7600G-H module connected to my Arduino. Despite following the standard procedure, I consistently receive a 400 Bad Request error from the server.
Here is the sequence of AT commands I am using:
AT+CGDCONT=1,"IP","vzwinternet" OK AT+CGATT=1 OK AT+CGACT=1,1 OK
AT+NETOPEN OK +NETOPEN: 0 AT+CIPOPEN=0,"TCP","api.thingspeak.com",80 OK +CIPOPEN: 0,0
POST /update HTTP/1.1rn Host: api.thingspeak.comrn Connection: closern Content-Type: application/x-www-form-urlencodedrn Content-Length: 43rnrn api_key=jejeje&field1=80:30:habierta:apagadorn
<html> <head><title>400 Bad Request</title></head> <body> <center><h1>400 Bad Request</h1></center> </body> </html>
I have verified that the Content-Length is correct and that all the required headers are included.
Could anyone provide insights or suggestions on what might be causing this issue? Any help would be greatly appreciated.
Thank you! thingspeak MATLAB Answers — New Questions
Help in the control of an active three-phase pfc rectifier (active front end)
Hi, I have a problem with the control of a three-phase pfc rectifier controlled by MOSFETs (half bridge for each abc branch). I have implemented the physical part, which is the part I show in the first image (I also upload the model in case you want to see the values I have used). When I simulate with the SVPWM control it is not able to control the current and it quickly gets very high values in the three-phase part. The three-phase voltage is obviously OK, but the DC bus voltage is wrong. At the end I attach a couple of pictures with the results.
The problem is that the control does not work properly. Control in the outer loop is DC voltage (800 V is the reference). As you can see iin the result, voltage go to zero and do not follow the reference.
I don’t understand what is wrong in the model because I think the controllers are well implemented. Can someone please help me?
Plant of the model:
I also attach an image of how the control is implemented:
Results:
Thanks.Hi, I have a problem with the control of a three-phase pfc rectifier controlled by MOSFETs (half bridge for each abc branch). I have implemented the physical part, which is the part I show in the first image (I also upload the model in case you want to see the values I have used). When I simulate with the SVPWM control it is not able to control the current and it quickly gets very high values in the three-phase part. The three-phase voltage is obviously OK, but the DC bus voltage is wrong. At the end I attach a couple of pictures with the results.
The problem is that the control does not work properly. Control in the outer loop is DC voltage (800 V is the reference). As you can see iin the result, voltage go to zero and do not follow the reference.
I don’t understand what is wrong in the model because I think the controllers are well implemented. Can someone please help me?
Plant of the model:
I also attach an image of how the control is implemented:
Results:
Thanks. Hi, I have a problem with the control of a three-phase pfc rectifier controlled by MOSFETs (half bridge for each abc branch). I have implemented the physical part, which is the part I show in the first image (I also upload the model in case you want to see the values I have used). When I simulate with the SVPWM control it is not able to control the current and it quickly gets very high values in the three-phase part. The three-phase voltage is obviously OK, but the DC bus voltage is wrong. At the end I attach a couple of pictures with the results.
The problem is that the control does not work properly. Control in the outer loop is DC voltage (800 V is the reference). As you can see iin the result, voltage go to zero and do not follow the reference.
I don’t understand what is wrong in the model because I think the controllers are well implemented. Can someone please help me?
Plant of the model:
I also attach an image of how the control is implemented:
Results:
Thanks. pfc, active control rectifier, three phase rectifier, active front end, six switches rectifier MATLAB Answers — New Questions
How to clear the workspace from within a program?
I have a program that must have the workspace clear when it runs or it returns invalid results. I don’t want the user to need to remember to type CLEAR ALL before running. How can I get the same effect from within a program (at the start)?I have a program that must have the workspace clear when it runs or it returns invalid results. I don’t want the user to need to remember to type CLEAR ALL before running. How can I get the same effect from within a program (at the start)? I have a program that must have the workspace clear when it runs or it returns invalid results. I don’t want the user to need to remember to type CLEAR ALL before running. How can I get the same effect from within a program (at the start)? clear all, inprogram clear, workspace clear MATLAB Answers — New Questions
How to Reduce Oscillations (not noise) in a Signal?
How can oscillations be reduced in signals similar to the one shown in Figure 1 to achieve results like those in Figure 2? Please note that it is not a denoising or smoothing problem.How can oscillations be reduced in signals similar to the one shown in Figure 1 to achieve results like those in Figure 2? Please note that it is not a denoising or smoothing problem. How can oscillations be reduced in signals similar to the one shown in Figure 1 to achieve results like those in Figure 2? Please note that it is not a denoising or smoothing problem. signal processing, oscillation MATLAB Answers — New Questions
Simulink model taking longer to open starting in MATLAB R2018b
Starting in R2018b, my Simulink model is taking a significantly longer time to open. Why?
My model uses custom code that I specified in the Configuration Parameters > Simulation Target > Custom Code > Source Files and Libraries panes.Starting in R2018b, my Simulink model is taking a significantly longer time to open. Why?
My model uses custom code that I specified in the Configuration Parameters > Simulation Target > Custom Code > Source Files and Libraries panes. Starting in R2018b, my Simulink model is taking a significantly longer time to open. Why?
My model uses custom code that I specified in the Configuration Parameters > Simulation Target > Custom Code > Source Files and Libraries panes. custom, open, open_system, getfrontendoptions, simparsecustomcode MATLAB Answers — New Questions
Does Matlab automatically vectorize for loops?
I currently have Python code that takes 1.5 hours to calculate 450+ million Levenshtein distances between 30,011 text labels of no more than 20 characters each. Currently migrating it to Matlab to see the JiT compilation allows optimizations of flow control. The Python implementation uses Anaconda’s CPython, so no JiT, and there is a distinct possibility that Matlab could be much faster.
Years ago, I recall reading that Matlab automatically vectorizes for loops. I cannot find any such mentions now. Is this just assumed to be part of the JiT compilation?
There will be 2 levels of for-loops, one nested within the other, to iterate over matrix rows and columns. Each iteration will call editDistance, so I don’t know if that will prevent vectorization, even if automated vectorization was available.I currently have Python code that takes 1.5 hours to calculate 450+ million Levenshtein distances between 30,011 text labels of no more than 20 characters each. Currently migrating it to Matlab to see the JiT compilation allows optimizations of flow control. The Python implementation uses Anaconda’s CPython, so no JiT, and there is a distinct possibility that Matlab could be much faster.
Years ago, I recall reading that Matlab automatically vectorizes for loops. I cannot find any such mentions now. Is this just assumed to be part of the JiT compilation?
There will be 2 levels of for-loops, one nested within the other, to iterate over matrix rows and columns. Each iteration will call editDistance, so I don’t know if that will prevent vectorization, even if automated vectorization was available. I currently have Python code that takes 1.5 hours to calculate 450+ million Levenshtein distances between 30,011 text labels of no more than 20 characters each. Currently migrating it to Matlab to see the JiT compilation allows optimizations of flow control. The Python implementation uses Anaconda’s CPython, so no JiT, and there is a distinct possibility that Matlab could be much faster.
Years ago, I recall reading that Matlab automatically vectorizes for loops. I cannot find any such mentions now. Is this just assumed to be part of the JiT compilation?
There will be 2 levels of for-loops, one nested within the other, to iterate over matrix rows and columns. Each iteration will call editDistance, so I don’t know if that will prevent vectorization, even if automated vectorization was available. vectorization, jit MATLAB Answers — New Questions