Category: Matlab
Category Archives: Matlab
What is the Image Processing Toolbox Convention for Input to freqz2() ?
I was trying to learn how to use the function freqz2 in the Image Processing Toolbox. That doc page says that the FIR filter input, h, is "in the form of a computational molecule." What is a "computational molecule?" A quick internet search didn’t help much. Is that a term commonly used in image processing?
Anyway, because I don’t know what that means, I searched around some more and found on What Is Image Filtering in the Spatial Domain? the statement that "The Image Processing Toolbox™ filter design functions return correlation kernels." So I assumed that h should be a correlation kernel (don’t know why the doc page for freqz2 doesn’t just say that if that is, in fact, the case).
Aside: the linked doc page on "What is Image Filtering …." has a mistake. The graphic immediately under the line "Computing the (2, 4) Output of Convolution" says "value of rotated convolution kernel" but it should say "value of rotated correlation kernel."
Define an input FIR filter
rng(100);
h = rand(5);
If that’s a correlation kernel with the origin at the center and the upper left corner corresponding to (-2,-2), then it seems to me that its 5×5 frequency response would be
H0 = fftshift(fft2(ifftshift(h)));
In order to get the same result from freqz2(), the input has to be rotated 180 deg
H1 = freqz2(rot90(h,-2),5,5,[1 1]);
isequal(H1,H0)
Inside the code of freqz2 is the comment "% Unrotate filter since FIR filters are rotated." Rotated relative to what?
Can anyone explain why that rot90 is needed on input to freqz2 or where the anlaysis has an incorrect assumption or calculation, or any other misunderstanding on my part?I was trying to learn how to use the function freqz2 in the Image Processing Toolbox. That doc page says that the FIR filter input, h, is "in the form of a computational molecule." What is a "computational molecule?" A quick internet search didn’t help much. Is that a term commonly used in image processing?
Anyway, because I don’t know what that means, I searched around some more and found on What Is Image Filtering in the Spatial Domain? the statement that "The Image Processing Toolbox™ filter design functions return correlation kernels." So I assumed that h should be a correlation kernel (don’t know why the doc page for freqz2 doesn’t just say that if that is, in fact, the case).
Aside: the linked doc page on "What is Image Filtering …." has a mistake. The graphic immediately under the line "Computing the (2, 4) Output of Convolution" says "value of rotated convolution kernel" but it should say "value of rotated correlation kernel."
Define an input FIR filter
rng(100);
h = rand(5);
If that’s a correlation kernel with the origin at the center and the upper left corner corresponding to (-2,-2), then it seems to me that its 5×5 frequency response would be
H0 = fftshift(fft2(ifftshift(h)));
In order to get the same result from freqz2(), the input has to be rotated 180 deg
H1 = freqz2(rot90(h,-2),5,5,[1 1]);
isequal(H1,H0)
Inside the code of freqz2 is the comment "% Unrotate filter since FIR filters are rotated." Rotated relative to what?
Can anyone explain why that rot90 is needed on input to freqz2 or where the anlaysis has an incorrect assumption or calculation, or any other misunderstanding on my part? I was trying to learn how to use the function freqz2 in the Image Processing Toolbox. That doc page says that the FIR filter input, h, is "in the form of a computational molecule." What is a "computational molecule?" A quick internet search didn’t help much. Is that a term commonly used in image processing?
Anyway, because I don’t know what that means, I searched around some more and found on What Is Image Filtering in the Spatial Domain? the statement that "The Image Processing Toolbox™ filter design functions return correlation kernels." So I assumed that h should be a correlation kernel (don’t know why the doc page for freqz2 doesn’t just say that if that is, in fact, the case).
Aside: the linked doc page on "What is Image Filtering …." has a mistake. The graphic immediately under the line "Computing the (2, 4) Output of Convolution" says "value of rotated convolution kernel" but it should say "value of rotated correlation kernel."
Define an input FIR filter
rng(100);
h = rand(5);
If that’s a correlation kernel with the origin at the center and the upper left corner corresponding to (-2,-2), then it seems to me that its 5×5 frequency response would be
H0 = fftshift(fft2(ifftshift(h)));
In order to get the same result from freqz2(), the input has to be rotated 180 deg
H1 = freqz2(rot90(h,-2),5,5,[1 1]);
isequal(H1,H0)
Inside the code of freqz2 is the comment "% Unrotate filter since FIR filters are rotated." Rotated relative to what?
Can anyone explain why that rot90 is needed on input to freqz2 or where the anlaysis has an incorrect assumption or calculation, or any other misunderstanding on my part? freqz2, fir filter convention MATLAB Answers — New Questions
Two-sample Anderson-Darling tests
Is there a function in Matlab which can perform a 2-sample Anderson-Darling test, as described/shown on Cross Validated or on R?
Indeed, to me, it looks like that the Matlab function called adtest is not distribution-free (i.e. it is not non-parametric), and it is limited to some known distributions (i.e. ‘norm’, ‘exp’, ‘ev’, ‘logn’ and ‘weibull’). In my case I have just two empirical distributions (coming from two datasets).Is there a function in Matlab which can perform a 2-sample Anderson-Darling test, as described/shown on Cross Validated or on R?
Indeed, to me, it looks like that the Matlab function called adtest is not distribution-free (i.e. it is not non-parametric), and it is limited to some known distributions (i.e. ‘norm’, ‘exp’, ‘ev’, ‘logn’ and ‘weibull’). In my case I have just two empirical distributions (coming from two datasets). Is there a function in Matlab which can perform a 2-sample Anderson-Darling test, as described/shown on Cross Validated or on R?
Indeed, to me, it looks like that the Matlab function called adtest is not distribution-free (i.e. it is not non-parametric), and it is limited to some known distributions (i.e. ‘norm’, ‘exp’, ‘ev’, ‘logn’ and ‘weibull’). In my case I have just two empirical distributions (coming from two datasets). adtest, anderson-darling test, statistical hypothesis test, two-sample MATLAB Answers — New Questions
How to normalize the rewards in RL
I recently learned normalizing the rewards is a key step in RL since rewards can vary over a large range of magnitudes, and the function approximators being used in RL are usually not invariant to the scale of the input. And It usually results in faster learning. I also learned that to normalize all discounted rewards across all episodes, we compute the mean and standard deviation of all the discounted rewards, and we subtract the mean from each discounted reward, and divide by the standard deviation.
How can I implement this in MATLAB? is it internally implemented in matlab? if not how can I transfer the necessary variables between episodes?I recently learned normalizing the rewards is a key step in RL since rewards can vary over a large range of magnitudes, and the function approximators being used in RL are usually not invariant to the scale of the input. And It usually results in faster learning. I also learned that to normalize all discounted rewards across all episodes, we compute the mean and standard deviation of all the discounted rewards, and we subtract the mean from each discounted reward, and divide by the standard deviation.
How can I implement this in MATLAB? is it internally implemented in matlab? if not how can I transfer the necessary variables between episodes? I recently learned normalizing the rewards is a key step in RL since rewards can vary over a large range of magnitudes, and the function approximators being used in RL are usually not invariant to the scale of the input. And It usually results in faster learning. I also learned that to normalize all discounted rewards across all episodes, we compute the mean and standard deviation of all the discounted rewards, and we subtract the mean from each discounted reward, and divide by the standard deviation.
How can I implement this in MATLAB? is it internally implemented in matlab? if not how can I transfer the necessary variables between episodes? reinforcement learning, rl, reward MATLAB Answers — New Questions
How to update value when different value is 0 in simulink?
Hi everyone,
I am creating a Simulink model to control an asynchronous motor with a current source inverter. I want to simulate a ramp-up by changing the frequency from an initial value to the rated value using a rate limiter. The issue is that I want to update the reference frequency value only when the counter (for selecting switches) reaches 0.
I have tried using the Signal Sample and Hold block as well as a combination of switches and memory blocks, but it is not working. The counter should always change from 0 to 180, but it is not behaving as expected.
Can anyone help with this?Hi everyone,
I am creating a Simulink model to control an asynchronous motor with a current source inverter. I want to simulate a ramp-up by changing the frequency from an initial value to the rated value using a rate limiter. The issue is that I want to update the reference frequency value only when the counter (for selecting switches) reaches 0.
I have tried using the Signal Sample and Hold block as well as a combination of switches and memory blocks, but it is not working. The counter should always change from 0 to 180, but it is not behaving as expected.
Can anyone help with this? Hi everyone,
I am creating a Simulink model to control an asynchronous motor with a current source inverter. I want to simulate a ramp-up by changing the frequency from an initial value to the rated value using a rate limiter. The issue is that I want to update the reference frequency value only when the counter (for selecting switches) reaches 0.
I have tried using the Signal Sample and Hold block as well as a combination of switches and memory blocks, but it is not working. The counter should always change from 0 to 180, but it is not behaving as expected.
Can anyone help with this? simulink, counter, electric_motor_control MATLAB Answers — New Questions
Plotting field over a discontinuous waveguide????
hi
I have x( 21 by 1) y(9by1) vectors
and i have to plot field over thesee points but the field is not defined over all points as there are discontinuities in waveguide..
I have a vector H of 150 by1 to be plotted in certain regions of x,y grid.
HOw to do that?
Thanks Gurpreethi
I have x( 21 by 1) y(9by1) vectors
and i have to plot field over thesee points but the field is not defined over all points as there are discontinuities in waveguide..
I have a vector H of 150 by1 to be plotted in certain regions of x,y grid.
HOw to do that?
Thanks Gurpreet hi
I have x( 21 by 1) y(9by1) vectors
and i have to plot field over thesee points but the field is not defined over all points as there are discontinuities in waveguide..
I have a vector H of 150 by1 to be plotted in certain regions of x,y grid.
HOw to do that?
Thanks Gurpreet waveguide MATLAB Answers — New Questions
Unable to Unpack Variables from Python to MATLAB Function in Simulink Model
Hi everyone,
I’m beginner in Matlab and I’m working on a project where I need to replace a scalar control block for an induction motor in Simulink with my own control block written in Python. The Python function calculates three variables that I need to pass back to MATLAB Function block, and convert to vector.
However, I’m running into an issue where MATLAB seems to treat these variables as non-iterable and can’t unpack them properly. Even though my Python function returns a tuple with the three variables, MATLAB can’t seem to process them as intended.
Here’s a summary of the setup:
MATLAB Function:
function Vabc = Run_in_Python(fRef)
Vabc = zeros(3, 1);
coder.extrinsic(‘py.ControllerPython.calc’);
result = cell(py.ControllerPython.calc(fRef));
Vabc = vertcat(result);
end
Error:
Python Error: TypeError: cannot unpack non-iterable int object Error in calc Error in ‘InductionMachineScalar/Control/Scalar controller/MATLAB Function’ (line 6)
Thanks in advance!Hi everyone,
I’m beginner in Matlab and I’m working on a project where I need to replace a scalar control block for an induction motor in Simulink with my own control block written in Python. The Python function calculates three variables that I need to pass back to MATLAB Function block, and convert to vector.
However, I’m running into an issue where MATLAB seems to treat these variables as non-iterable and can’t unpack them properly. Even though my Python function returns a tuple with the three variables, MATLAB can’t seem to process them as intended.
Here’s a summary of the setup:
MATLAB Function:
function Vabc = Run_in_Python(fRef)
Vabc = zeros(3, 1);
coder.extrinsic(‘py.ControllerPython.calc’);
result = cell(py.ControllerPython.calc(fRef));
Vabc = vertcat(result);
end
Error:
Python Error: TypeError: cannot unpack non-iterable int object Error in calc Error in ‘InductionMachineScalar/Control/Scalar controller/MATLAB Function’ (line 6)
Thanks in advance! Hi everyone,
I’m beginner in Matlab and I’m working on a project where I need to replace a scalar control block for an induction motor in Simulink with my own control block written in Python. The Python function calculates three variables that I need to pass back to MATLAB Function block, and convert to vector.
However, I’m running into an issue where MATLAB seems to treat these variables as non-iterable and can’t unpack them properly. Even though my Python function returns a tuple with the three variables, MATLAB can’t seem to process them as intended.
Here’s a summary of the setup:
MATLAB Function:
function Vabc = Run_in_Python(fRef)
Vabc = zeros(3, 1);
coder.extrinsic(‘py.ControllerPython.calc’);
result = cell(py.ControllerPython.calc(fRef));
Vabc = vertcat(result);
end
Error:
Python Error: TypeError: cannot unpack non-iterable int object Error in calc Error in ‘InductionMachineScalar/Control/Scalar controller/MATLAB Function’ (line 6)
Thanks in advance! matlab simulink python integration coder.extrinsic, simulink, python, cell arrays MATLAB Answers — New Questions
How to color values in corrplot function?
Hello,
I created a corrplot with the fisheriris dataset.
I wanted to add a 3rd dimension in the corrplot coloring the values to the corresponding species, like in the following plot.
Is this possible in Matlab?
Thanks for the help and all the best!Hello,
I created a corrplot with the fisheriris dataset.
I wanted to add a 3rd dimension in the corrplot coloring the values to the corresponding species, like in the following plot.
Is this possible in Matlab?
Thanks for the help and all the best! Hello,
I created a corrplot with the fisheriris dataset.
I wanted to add a 3rd dimension in the corrplot coloring the values to the corresponding species, like in the following plot.
Is this possible in Matlab?
Thanks for the help and all the best! corrplot, plotting MATLAB Answers — New Questions
Model unable to output any successful draws in Gibbs sampling
I am trying to estimate a structural VAR model using traditional sign and zero restrictions for the identification of shocks and Minnesota priors. When I adapt the (working) code to run on my data, I am unable to generate any successful draws in the Gibbs sampling phase. I have tried playing around with the settings of the Minnesota prior, as well as number of observations, number of variables, number of restrictions, running the model in First-Differences, and still can’t get any successful draws. Does anyone have any ideas as to why this might be happening or anything I can try next?
Thanks in advance,
AlexI am trying to estimate a structural VAR model using traditional sign and zero restrictions for the identification of shocks and Minnesota priors. When I adapt the (working) code to run on my data, I am unable to generate any successful draws in the Gibbs sampling phase. I have tried playing around with the settings of the Minnesota prior, as well as number of observations, number of variables, number of restrictions, running the model in First-Differences, and still can’t get any successful draws. Does anyone have any ideas as to why this might be happening or anything I can try next?
Thanks in advance,
Alex I am trying to estimate a structural VAR model using traditional sign and zero restrictions for the identification of shocks and Minnesota priors. When I adapt the (working) code to run on my data, I am unable to generate any successful draws in the Gibbs sampling phase. I have tried playing around with the settings of the Minnesota prior, as well as number of observations, number of variables, number of restrictions, running the model in First-Differences, and still can’t get any successful draws. Does anyone have any ideas as to why this might be happening or anything I can try next?
Thanks in advance,
Alex time series, svar model, economics MATLAB Answers — New Questions
Error imposing space-derivative-dependent boundary condition with solvepde using variable state.uy – Error: Unrecognized field name “uy”.
I would appreciate any advice of the following. I am working with PDE Tool box solvepde and a 2d membrane simulation and struggling to impose a spatial-derivative-dependent absorbing a boundary condition on an edge. I am following PDE Toolbox documentation trying two different methods, one (commented out) below using a simple anonymous function and another using a matlab function. These methods work with variables like location.x, location.y, and state.time but seem to fail me with the spatial derivatives. Here is the code snippet in the setup preamble to calling solvepde:
case 3
alpha_absorb=1;beta_absorb=0.0;
m3=m_func(0,ribbonlength/2);
c3=c_func(0,ribbonlength/2);
v3=sqrt(c3(3)/m3);
% my_g= @(location, state,alpha,beta) (-alpha_y *v3.* state.uy +beta_y*state.uyy);
%
% g=@(location,state)(-alpha_y *v3.* state.uy +beta_y*state.uyy)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3);
applyBoundaryCondition(model, ‘neumann’, ‘Edge’, topEdgeID, "q",0,…
‘g’, g);
end
function absorb=my_g(location, state,alpha_absorb,beta_absorb,v3)
n1=1;
nr=numel(location.x);
absorb=zeros(n1,nr);
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
end
For the method shown, solvepde throws the following error ( and the commented out anonymous functio method throws a similar error)
Unrecognized field name "uy".
Error in MembraneWaveExplorer>my_g (line 303)
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
Error in MembraneWaveExplorer>@(location,state)my_g(location,state,alpha_absorb,beta_absorb,v3) (line 295)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, …I would appreciate any advice of the following. I am working with PDE Tool box solvepde and a 2d membrane simulation and struggling to impose a spatial-derivative-dependent absorbing a boundary condition on an edge. I am following PDE Toolbox documentation trying two different methods, one (commented out) below using a simple anonymous function and another using a matlab function. These methods work with variables like location.x, location.y, and state.time but seem to fail me with the spatial derivatives. Here is the code snippet in the setup preamble to calling solvepde:
case 3
alpha_absorb=1;beta_absorb=0.0;
m3=m_func(0,ribbonlength/2);
c3=c_func(0,ribbonlength/2);
v3=sqrt(c3(3)/m3);
% my_g= @(location, state,alpha,beta) (-alpha_y *v3.* state.uy +beta_y*state.uyy);
%
% g=@(location,state)(-alpha_y *v3.* state.uy +beta_y*state.uyy)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3);
applyBoundaryCondition(model, ‘neumann’, ‘Edge’, topEdgeID, "q",0,…
‘g’, g);
end
function absorb=my_g(location, state,alpha_absorb,beta_absorb,v3)
n1=1;
nr=numel(location.x);
absorb=zeros(n1,nr);
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
end
For the method shown, solvepde throws the following error ( and the commented out anonymous functio method throws a similar error)
Unrecognized field name "uy".
Error in MembraneWaveExplorer>my_g (line 303)
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
Error in MembraneWaveExplorer>@(location,state)my_g(location,state,alpha_absorb,beta_absorb,v3) (line 295)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, … I would appreciate any advice of the following. I am working with PDE Tool box solvepde and a 2d membrane simulation and struggling to impose a spatial-derivative-dependent absorbing a boundary condition on an edge. I am following PDE Toolbox documentation trying two different methods, one (commented out) below using a simple anonymous function and another using a matlab function. These methods work with variables like location.x, location.y, and state.time but seem to fail me with the spatial derivatives. Here is the code snippet in the setup preamble to calling solvepde:
case 3
alpha_absorb=1;beta_absorb=0.0;
m3=m_func(0,ribbonlength/2);
c3=c_func(0,ribbonlength/2);
v3=sqrt(c3(3)/m3);
% my_g= @(location, state,alpha,beta) (-alpha_y *v3.* state.uy +beta_y*state.uyy);
%
% g=@(location,state)(-alpha_y *v3.* state.uy +beta_y*state.uyy)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3);
applyBoundaryCondition(model, ‘neumann’, ‘Edge’, topEdgeID, "q",0,…
‘g’, g);
end
function absorb=my_g(location, state,alpha_absorb,beta_absorb,v3)
n1=1;
nr=numel(location.x);
absorb=zeros(n1,nr);
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
end
For the method shown, solvepde throws the following error ( and the commented out anonymous functio method throws a similar error)
Unrecognized field name "uy".
Error in MembraneWaveExplorer>my_g (line 303)
absorb(1,:)=(-alpha_absorb *v3.* state.uy +beta_absorb*state.uyy);
Error in MembraneWaveExplorer>@(location,state)my_g(location,state,alpha_absorb,beta_absorb,v3) (line 295)
g=@(location,state) my_g(location, state,alpha_absorb,beta_absorb,v3)
Error in pde.internal.pde3DBCImpl/callNeumannFuncOnFace (line 58)
bci = func(appRegion, state);
Error in pde.internal.pde3DBCImpl/setNeumannBCOnFace (line 133)
faceG = self.callNeumannFuncOnFace(bci,xyzAllFaceNodes, sPts, bci.g, …
Error in pde.internal.pde3DBCImpl/getBCMatrices (line 66)
[Qi, Gi] = setNeumannBCOnFace(self, bcsi);
Error in pde.internal.FESolverUtilities/assembleBoundary (line 74)
bcmat = bcImpl.getBCMatrices(u,time,gmat);
Error in pde.internal.FESolverUtilities/assembleSelectedFEMatrices (line 30)
bmat = self.assembleBoundary(u,time,gmatrix);
Error in pde.DiscretizedPDEModel/initialDiscretization (line 50)
femat0 = self.thePde.assembleSelectedFEMatrices(self.p, self.t, self.coefstruct, u0, tdummy, requiredMats, false);
Error in pde.DiscretizedPDEModel (line 33)
obj = obj.initialDiscretization(u0,tdummy);
Error in pde.DynamicDiscretizedPDEModel (line 32)
obj=obj@pde.DiscretizedPDEModel(thePde,p,e,t,coefstruct,u0,false);
Error in pde.internal.FESolverUtilities/solveTimeDependent (line 27)
femodel=pde.DynamicDiscretizedPDEModel(self,p,e,t,coefstruct,u0,tlist,tsecondOrder);
Error in pde.PDEModel/solvepde (line 57)
[u,dudt] = self.solveTimeDependent(coefstruct, u0, ut0, tlist, … pdesolve, edge boundary condition MATLAB Answers — New Questions
RL DDPG agent does not seem to learn, aircraft control problem
Hello everyone,
I’m back with some updates on my mixed Reinforcement Learning (RL) and Supervised Learning training. A few days ago, I posted a question here on MathWorks about the working principle of “external actions” in the RL training block. Based on the suggestions I received, I have started a hybrid training approach.
I begin by injecting external actions from the controller for 75 seconds (1/4 of the entire episode length). After this, the agent takes action until the pitch rate error reaches 5 degrees per second. When this threshold is reached, the external agent takes control again. The external actions are then cut off when the pitch rate is very close to 0 degrees per second for about 40 seconds. The agent then takes control again, and this cycle continues.
I have also introduced a maximum number of allowed interventions. If the agent exceeds this threshold, the simulation stops and a penalty is applied. I also apply a penalty every time the external controller must intervene again, while a bonus is given every time the agent makes progress within the time window when it is left alone. This system of bonuses and penalties is added to the standard reward, which takes into account the altitude error, the flight path angle error, and the pitch rate error. The weight coefficients for these errors are 1, 1, and 10, respectively, because I want to emphasize that the aircraft must maintain level wings.
The initial conditions are always random, and the setpoint for altitude is always set 50 meters above the initial altitude.
Unfortunately, after the first training session, I haven’t seen any progress. According to your opinion, is it worth taking another attempt or is the whole setup wrong? Thank you.Hello everyone,
I’m back with some updates on my mixed Reinforcement Learning (RL) and Supervised Learning training. A few days ago, I posted a question here on MathWorks about the working principle of “external actions” in the RL training block. Based on the suggestions I received, I have started a hybrid training approach.
I begin by injecting external actions from the controller for 75 seconds (1/4 of the entire episode length). After this, the agent takes action until the pitch rate error reaches 5 degrees per second. When this threshold is reached, the external agent takes control again. The external actions are then cut off when the pitch rate is very close to 0 degrees per second for about 40 seconds. The agent then takes control again, and this cycle continues.
I have also introduced a maximum number of allowed interventions. If the agent exceeds this threshold, the simulation stops and a penalty is applied. I also apply a penalty every time the external controller must intervene again, while a bonus is given every time the agent makes progress within the time window when it is left alone. This system of bonuses and penalties is added to the standard reward, which takes into account the altitude error, the flight path angle error, and the pitch rate error. The weight coefficients for these errors are 1, 1, and 10, respectively, because I want to emphasize that the aircraft must maintain level wings.
The initial conditions are always random, and the setpoint for altitude is always set 50 meters above the initial altitude.
Unfortunately, after the first training session, I haven’t seen any progress. According to your opinion, is it worth taking another attempt or is the whole setup wrong? Thank you. Hello everyone,
I’m back with some updates on my mixed Reinforcement Learning (RL) and Supervised Learning training. A few days ago, I posted a question here on MathWorks about the working principle of “external actions” in the RL training block. Based on the suggestions I received, I have started a hybrid training approach.
I begin by injecting external actions from the controller for 75 seconds (1/4 of the entire episode length). After this, the agent takes action until the pitch rate error reaches 5 degrees per second. When this threshold is reached, the external agent takes control again. The external actions are then cut off when the pitch rate is very close to 0 degrees per second for about 40 seconds. The agent then takes control again, and this cycle continues.
I have also introduced a maximum number of allowed interventions. If the agent exceeds this threshold, the simulation stops and a penalty is applied. I also apply a penalty every time the external controller must intervene again, while a bonus is given every time the agent makes progress within the time window when it is left alone. This system of bonuses and penalties is added to the standard reward, which takes into account the altitude error, the flight path angle error, and the pitch rate error. The weight coefficients for these errors are 1, 1, and 10, respectively, because I want to emphasize that the aircraft must maintain level wings.
The initial conditions are always random, and the setpoint for altitude is always set 50 meters above the initial altitude.
Unfortunately, after the first training session, I haven’t seen any progress. According to your opinion, is it worth taking another attempt or is the whole setup wrong? Thank you. rl, reinforcement learning, machine learning, ddpg, control theory, aircraft MATLAB Answers — New Questions
F-Test Fixed Effects SSRs – reduced model smaller than complete model
Hello! I’m trying to make a modelwide (not individual coefficient specific, like with anova) f-test for my fixed-effects regressions – I can’t seem to find a native function in matlab for them so I’m just building them, but if you’ve got one send it my way. My plan was to do something like the following:
fe_green_money = fitlme(fixed_effects_green_data, ‘LogPatents ~ MoneyInvested + Dummy0Patents + (1|Organization)’)
fe_green_money_reduced = fitlme(fixed_effects_green_data, ‘LogPatents ~ 1 + (1|Organization)’)
F_fe_green_money = ((fe_green_money_reduced.SSR – fe_green_money.SSR) / 2) / (fe_green_money.SSR / fe_green_money.DFE);
p_fe_green_money = 1 – fcdf(F_fe_green_money, 2, fe_green_money.DFE)
But I’m running into a problem – fe_green_money_reduced.SSR is smaller (almost 2/3rds the size) than fe_green_money.SSR, which as I understand it should be impossible… Is there an alternate way I should be getting the SSRs or am I doing something wrong or is there another explanation I’m missing?Hello! I’m trying to make a modelwide (not individual coefficient specific, like with anova) f-test for my fixed-effects regressions – I can’t seem to find a native function in matlab for them so I’m just building them, but if you’ve got one send it my way. My plan was to do something like the following:
fe_green_money = fitlme(fixed_effects_green_data, ‘LogPatents ~ MoneyInvested + Dummy0Patents + (1|Organization)’)
fe_green_money_reduced = fitlme(fixed_effects_green_data, ‘LogPatents ~ 1 + (1|Organization)’)
F_fe_green_money = ((fe_green_money_reduced.SSR – fe_green_money.SSR) / 2) / (fe_green_money.SSR / fe_green_money.DFE);
p_fe_green_money = 1 – fcdf(F_fe_green_money, 2, fe_green_money.DFE)
But I’m running into a problem – fe_green_money_reduced.SSR is smaller (almost 2/3rds the size) than fe_green_money.SSR, which as I understand it should be impossible… Is there an alternate way I should be getting the SSRs or am I doing something wrong or is there another explanation I’m missing? Hello! I’m trying to make a modelwide (not individual coefficient specific, like with anova) f-test for my fixed-effects regressions – I can’t seem to find a native function in matlab for them so I’m just building them, but if you’ve got one send it my way. My plan was to do something like the following:
fe_green_money = fitlme(fixed_effects_green_data, ‘LogPatents ~ MoneyInvested + Dummy0Patents + (1|Organization)’)
fe_green_money_reduced = fitlme(fixed_effects_green_data, ‘LogPatents ~ 1 + (1|Organization)’)
F_fe_green_money = ((fe_green_money_reduced.SSR – fe_green_money.SSR) / 2) / (fe_green_money.SSR / fe_green_money.DFE);
p_fe_green_money = 1 – fcdf(F_fe_green_money, 2, fe_green_money.DFE)
But I’m running into a problem – fe_green_money_reduced.SSR is smaller (almost 2/3rds the size) than fe_green_money.SSR, which as I understand it should be impossible… Is there an alternate way I should be getting the SSRs or am I doing something wrong or is there another explanation I’m missing? fixed effects, matlab, f-test, sum of squared residuals MATLAB Answers — New Questions
Why I have a PV voltage at zero irradiance ? Why I don’t have current reading ?
Hello there,
I am trying to simulate the performance of a PV system and I have the site irradiance and assume a constant temperature. However, the voltage readings are not looks right. The voltage rise rate doesn’t look right and I even have a voltage at zero irradiance and I have zero current reading as shown in the attachments. When I connected a current source to drain current, results become more unlogic to me.Hello there,
I am trying to simulate the performance of a PV system and I have the site irradiance and assume a constant temperature. However, the voltage readings are not looks right. The voltage rise rate doesn’t look right and I even have a voltage at zero irradiance and I have zero current reading as shown in the attachments. When I connected a current source to drain current, results become more unlogic to me. Hello there,
I am trying to simulate the performance of a PV system and I have the site irradiance and assume a constant temperature. However, the voltage readings are not looks right. The voltage rise rate doesn’t look right and I even have a voltage at zero irradiance and I have zero current reading as shown in the attachments. When I connected a current source to drain current, results become more unlogic to me. simulink, pv MATLAB Answers — New Questions
How to build an empiric cdf/pdf of a compound poisson continuos distribution
Hi everyone.
as I said in the title i’m trying to obtain the empiric cdf (or pdf) of a compound poisson continuos distribution. Let be a compound poisson distribution with as parameters, while being the parameter of the random variable N (poisson) and F being the distribution of the i-th Y (assuming all are iid and extracted from the same lognormal distribution of given parameters). I managed to build a vector called "x_ptf" which contains random values extracted from , however im struggling into obtaining the empirical cdf/pdf.
clear all; close all; clc
rng(200724)
%mean and standard deviation of a given sample (sample of Yi)
mu_c = 4432.62; var_c= 533130.21;
%lognormal parameters
var_log = log(var_c/mu_c^2+1); sig_log = sqrt(var_log);
mu_log = -var_log/2 +log(mu_c);
%Compound-Poisson distribution
lam = 570; %poisson distribution parameter
nsims = 10^5; %number of simulations
num = poissrnd(lam,1,nsims); %random numbers extracted from the N poisson variable
x_ptf = zeros(nsims,1); %iniziatiling the storage where the random generated numbers will be allocated
for i = 1:length(num)
x_ptf(i) = sum(lognrnd(mu_log,sig_log,1,num(i))); %building randomly generated numbers
end
[cdf, X_ptf] = ecdf(x_con);
X_con = X_con(2:end); cdf = cdf(2:end); %doing this because i get zero two times as the first two components of X_con vector
p = [cdf(1) diff(cdf)’]’; %building the pdf from the cdf
E = sum(X_con.*p); %empirical mean
plot(X_con,p,’*’); %this plot doesn’t make sense
The empirical mean is correct, but the pdf distribution is wrong as shown by the plot. I think it means there’s some problem with the "ecfd" function im using, is there any way to fix? Or maybe some other functions i could try? Ive already used "ksdensity" but it’s not working. Can somebody help?Hi everyone.
as I said in the title i’m trying to obtain the empiric cdf (or pdf) of a compound poisson continuos distribution. Let be a compound poisson distribution with as parameters, while being the parameter of the random variable N (poisson) and F being the distribution of the i-th Y (assuming all are iid and extracted from the same lognormal distribution of given parameters). I managed to build a vector called "x_ptf" which contains random values extracted from , however im struggling into obtaining the empirical cdf/pdf.
clear all; close all; clc
rng(200724)
%mean and standard deviation of a given sample (sample of Yi)
mu_c = 4432.62; var_c= 533130.21;
%lognormal parameters
var_log = log(var_c/mu_c^2+1); sig_log = sqrt(var_log);
mu_log = -var_log/2 +log(mu_c);
%Compound-Poisson distribution
lam = 570; %poisson distribution parameter
nsims = 10^5; %number of simulations
num = poissrnd(lam,1,nsims); %random numbers extracted from the N poisson variable
x_ptf = zeros(nsims,1); %iniziatiling the storage where the random generated numbers will be allocated
for i = 1:length(num)
x_ptf(i) = sum(lognrnd(mu_log,sig_log,1,num(i))); %building randomly generated numbers
end
[cdf, X_ptf] = ecdf(x_con);
X_con = X_con(2:end); cdf = cdf(2:end); %doing this because i get zero two times as the first two components of X_con vector
p = [cdf(1) diff(cdf)’]’; %building the pdf from the cdf
E = sum(X_con.*p); %empirical mean
plot(X_con,p,’*’); %this plot doesn’t make sense
The empirical mean is correct, but the pdf distribution is wrong as shown by the plot. I think it means there’s some problem with the "ecfd" function im using, is there any way to fix? Or maybe some other functions i could try? Ive already used "ksdensity" but it’s not working. Can somebody help? Hi everyone.
as I said in the title i’m trying to obtain the empiric cdf (or pdf) of a compound poisson continuos distribution. Let be a compound poisson distribution with as parameters, while being the parameter of the random variable N (poisson) and F being the distribution of the i-th Y (assuming all are iid and extracted from the same lognormal distribution of given parameters). I managed to build a vector called "x_ptf" which contains random values extracted from , however im struggling into obtaining the empirical cdf/pdf.
clear all; close all; clc
rng(200724)
%mean and standard deviation of a given sample (sample of Yi)
mu_c = 4432.62; var_c= 533130.21;
%lognormal parameters
var_log = log(var_c/mu_c^2+1); sig_log = sqrt(var_log);
mu_log = -var_log/2 +log(mu_c);
%Compound-Poisson distribution
lam = 570; %poisson distribution parameter
nsims = 10^5; %number of simulations
num = poissrnd(lam,1,nsims); %random numbers extracted from the N poisson variable
x_ptf = zeros(nsims,1); %iniziatiling the storage where the random generated numbers will be allocated
for i = 1:length(num)
x_ptf(i) = sum(lognrnd(mu_log,sig_log,1,num(i))); %building randomly generated numbers
end
[cdf, X_ptf] = ecdf(x_con);
X_con = X_con(2:end); cdf = cdf(2:end); %doing this because i get zero two times as the first two components of X_con vector
p = [cdf(1) diff(cdf)’]’; %building the pdf from the cdf
E = sum(X_con.*p); %empirical mean
plot(X_con,p,’*’); %this plot doesn’t make sense
The empirical mean is correct, but the pdf distribution is wrong as shown by the plot. I think it means there’s some problem with the "ecfd" function im using, is there any way to fix? Or maybe some other functions i could try? Ive already used "ksdensity" but it’s not working. Can somebody help? matlab, montecarlo, random number generator, empirical cdf, statistics MATLAB Answers — New Questions
How to drive a prismatic joint by setting the input to “motion / provided by input”
I would like to set the input of the prismatic joint to "motion / provided by input" and raise it by 0.5 meters. As far as I know, a prismatic joint can be driven to a target position if it has inputs for position, velocity, and acceleration. However, I do not know the method to input these values. If anyone knows, could you please provide an example of the input method? Thank you.I would like to set the input of the prismatic joint to "motion / provided by input" and raise it by 0.5 meters. As far as I know, a prismatic joint can be driven to a target position if it has inputs for position, velocity, and acceleration. However, I do not know the method to input these values. If anyone knows, could you please provide an example of the input method? Thank you. I would like to set the input of the prismatic joint to "motion / provided by input" and raise it by 0.5 meters. As far as I know, a prismatic joint can be driven to a target position if it has inputs for position, velocity, and acceleration. However, I do not know the method to input these values. If anyone knows, could you please provide an example of the input method? Thank you. simulink, simscape MATLAB Answers — New Questions
How can I plot a bar chart with 4 different y-axis and standard deviation?
Hello,
I would like to have a bar plot with 4 different categories. Each has got its own y-axis, as shown in the attached picture.
<</matlabcentral/answers/uploaded_files/79925/bar_4y-axis.JPG>>
I figured out that there is a possibility to add mutlitple axis to a plot <https://de.mathworks.com/matlabcentral/fileexchange/9016-addaxis (addaxis)>. I’m using MATLAB R2014a, but I have access to R2017a at my university, if needed.
This is my current code, based on this <https://de.mathworks.com/matlabcentral/answers/136433-how-to-add-errorbars example>:
function[]=test_multiple_axis_2()
w=[1.0,2.5,3.9,9.8,5.5,6.6,8.8,5.4,7.4,6.5];
x=[11.1,21.5,23.7,19.8,14.7,15.6,12.7,13.8,14.9,11.4];
y=[15.7,16.8,25.9,18.6,16.9,20.4,23.8,19.9,17.8,21.8];
z=[21.5,26.8,17.7,18.9,16.5,25.6,29.3,18.9,26.8,24.5];
std_w=[0.7,1.7,1.7,4.5,0.1,4.8,1.2,4.1,1.4,1.0];
std_x=[2.2,5.4,3.3,5.2,1.9,4.8,5.4,3.2,4.7,6.2];
std_y=[6.2,2.5,2.6,3.9,7.8,4.1,5.6,4.2,6.6,7.1];
std_z=[8.7,5.4,6.5,7.4,2.3,2.2,1.9,9.2,1.7,7.5];
hb = bar([1 2 3 4 5 6 7 8 9 10],[w’ x’ y’ z’])
legend(‘w’,’x’,’y’,’z’);
set(gca, ‘FontSize’,12,’XTick’,[1 2 3 4 5 6 7 8 9 10],’XTickLabel’,{‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’});
ylabel(‘unit w’)%Here should be the addaxis code
errbar = [std_w; std_x; std_y; std_z]; % CREATE ‘errbar’ MATRIX
yd = [w’ x’ y’ z’]’;
keyboard %i didn’t understand the following code
hold on
for k1 = 1:3
errorbar([1:3]+.22*(k1-2), yd(k1,:), errbar(k1,:), ‘.k’, ‘LineWidth’,2)
end
hold off
returnHello,
I would like to have a bar plot with 4 different categories. Each has got its own y-axis, as shown in the attached picture.
<</matlabcentral/answers/uploaded_files/79925/bar_4y-axis.JPG>>
I figured out that there is a possibility to add mutlitple axis to a plot <https://de.mathworks.com/matlabcentral/fileexchange/9016-addaxis (addaxis)>. I’m using MATLAB R2014a, but I have access to R2017a at my university, if needed.
This is my current code, based on this <https://de.mathworks.com/matlabcentral/answers/136433-how-to-add-errorbars example>:
function[]=test_multiple_axis_2()
w=[1.0,2.5,3.9,9.8,5.5,6.6,8.8,5.4,7.4,6.5];
x=[11.1,21.5,23.7,19.8,14.7,15.6,12.7,13.8,14.9,11.4];
y=[15.7,16.8,25.9,18.6,16.9,20.4,23.8,19.9,17.8,21.8];
z=[21.5,26.8,17.7,18.9,16.5,25.6,29.3,18.9,26.8,24.5];
std_w=[0.7,1.7,1.7,4.5,0.1,4.8,1.2,4.1,1.4,1.0];
std_x=[2.2,5.4,3.3,5.2,1.9,4.8,5.4,3.2,4.7,6.2];
std_y=[6.2,2.5,2.6,3.9,7.8,4.1,5.6,4.2,6.6,7.1];
std_z=[8.7,5.4,6.5,7.4,2.3,2.2,1.9,9.2,1.7,7.5];
hb = bar([1 2 3 4 5 6 7 8 9 10],[w’ x’ y’ z’])
legend(‘w’,’x’,’y’,’z’);
set(gca, ‘FontSize’,12,’XTick’,[1 2 3 4 5 6 7 8 9 10],’XTickLabel’,{‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’});
ylabel(‘unit w’)%Here should be the addaxis code
errbar = [std_w; std_x; std_y; std_z]; % CREATE ‘errbar’ MATRIX
yd = [w’ x’ y’ z’]’;
keyboard %i didn’t understand the following code
hold on
for k1 = 1:3
errorbar([1:3]+.22*(k1-2), yd(k1,:), errbar(k1,:), ‘.k’, ‘LineWidth’,2)
end
hold off
return Hello,
I would like to have a bar plot with 4 different categories. Each has got its own y-axis, as shown in the attached picture.
<</matlabcentral/answers/uploaded_files/79925/bar_4y-axis.JPG>>
I figured out that there is a possibility to add mutlitple axis to a plot <https://de.mathworks.com/matlabcentral/fileexchange/9016-addaxis (addaxis)>. I’m using MATLAB R2014a, but I have access to R2017a at my university, if needed.
This is my current code, based on this <https://de.mathworks.com/matlabcentral/answers/136433-how-to-add-errorbars example>:
function[]=test_multiple_axis_2()
w=[1.0,2.5,3.9,9.8,5.5,6.6,8.8,5.4,7.4,6.5];
x=[11.1,21.5,23.7,19.8,14.7,15.6,12.7,13.8,14.9,11.4];
y=[15.7,16.8,25.9,18.6,16.9,20.4,23.8,19.9,17.8,21.8];
z=[21.5,26.8,17.7,18.9,16.5,25.6,29.3,18.9,26.8,24.5];
std_w=[0.7,1.7,1.7,4.5,0.1,4.8,1.2,4.1,1.4,1.0];
std_x=[2.2,5.4,3.3,5.2,1.9,4.8,5.4,3.2,4.7,6.2];
std_y=[6.2,2.5,2.6,3.9,7.8,4.1,5.6,4.2,6.6,7.1];
std_z=[8.7,5.4,6.5,7.4,2.3,2.2,1.9,9.2,1.7,7.5];
hb = bar([1 2 3 4 5 6 7 8 9 10],[w’ x’ y’ z’])
legend(‘w’,’x’,’y’,’z’);
set(gca, ‘FontSize’,12,’XTick’,[1 2 3 4 5 6 7 8 9 10],’XTickLabel’,{‘A’,’B’,’C’,’D’,’E’,’F’,’G’,’H’,’I’,’J’});
ylabel(‘unit w’)%Here should be the addaxis code
errbar = [std_w; std_x; std_y; std_z]; % CREATE ‘errbar’ MATRIX
yd = [w’ x’ y’ z’]’;
keyboard %i didn’t understand the following code
hold on
for k1 = 1:3
errorbar([1:3]+.22*(k1-2), yd(k1,:), errbar(k1,:), ‘.k’, ‘LineWidth’,2)
end
hold off
return bar plot, standard deviation, multiple axis MATLAB Answers — New Questions
plot an obtained function after several calculus
Good morning!
I want to plot the folloing function which is obtained after several calculus on Matlab,
syms s t a
Y=(sin(int(cos((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/9))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/18)))^2/100)^2*(exp(-2*s^(1/3)) + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s^(2/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/6)))^2/100)^2)^2, s, 0, 1))/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/18))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/36)))^2/100)*(exp(-2*t^(1/6)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t^(1/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100))^2/100)*(exp(-2*t) + cos(int(sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/12)))^2/100)*(exp(-2*s^(1/2)) + sin(0.00008414709848078965066525023216303*cos(s^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/4)))^2/100 + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s))^2/100)) + 1, s, 0, t^2))^2/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100)*(exp(-2*t^(1/2)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/4)))^2/100))^2/100)
in this function another variable appeared (denoted by ‘ a’ ) so i add it in symbolique variable
To plot this function i used the folowing code:
t_vals=linspace(0, 1, 10);
figure(1)
hold on
y_eval = double(eval(subs(Y(i+1),t, t_vals)))
plot(t_vals, y_eval;
hold offGood morning!
I want to plot the folloing function which is obtained after several calculus on Matlab,
syms s t a
Y=(sin(int(cos((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/9))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/18)))^2/100)^2*(exp(-2*s^(1/3)) + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s^(2/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/6)))^2/100)^2)^2, s, 0, 1))/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/18))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/36)))^2/100)*(exp(-2*t^(1/6)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t^(1/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100))^2/100)*(exp(-2*t) + cos(int(sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/12)))^2/100)*(exp(-2*s^(1/2)) + sin(0.00008414709848078965066525023216303*cos(s^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/4)))^2/100 + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s))^2/100)) + 1, s, 0, t^2))^2/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100)*(exp(-2*t^(1/2)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/4)))^2/100))^2/100)
in this function another variable appeared (denoted by ‘ a’ ) so i add it in symbolique variable
To plot this function i used the folowing code:
t_vals=linspace(0, 1, 10);
figure(1)
hold on
y_eval = double(eval(subs(Y(i+1),t, t_vals)))
plot(t_vals, y_eval;
hold off Good morning!
I want to plot the folloing function which is obtained after several calculus on Matlab,
syms s t a
Y=(sin(int(cos((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/9))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/18)))^2/100)^2*(exp(-2*s^(1/3)) + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s^(2/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/6)))^2/100)^2)^2, s, 0, 1))/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/18))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/36)))^2/100)*(exp(-2*t^(1/6)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t^(1/3)))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100))^2/100)*(exp(-2*t) + cos(int(sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(s^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/12)))^2/100)*(exp(-2*s^(1/2)) + sin(0.00008414709848078965066525023216303*cos(s^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/4)))^2/100 + cos(int(sin(0.00008414709848078965066525023216303*cos(a)^2 + 0.008414709848078965066525023216303*exp(-2*a^(1/2))) + 1, a, 0, s))^2/100)) + 1, s, 0, t^2))^2/100 + sin((sin(int(cos((0.00008414709848078965066525023216303*cos(s^(2/3))^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/3)))^2)^2, s, 0, 1))/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/6))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/12)))^2/100)*(exp(-2*t^(1/2)) + cos(int(sin(0.00008414709848078965066525023216303*cos(s)^2 + 0.008414709848078965066525023216303*exp(-2*s^(1/2))) + 1, s, 0, t))^2/100 + sin(0.00008414709848078965066525023216303*cos(t^(1/2))^2 + 0.008414709848078965066525023216303*exp(-2*t^(1/4)))^2/100))^2/100)
in this function another variable appeared (denoted by ‘ a’ ) so i add it in symbolique variable
To plot this function i used the folowing code:
t_vals=linspace(0, 1, 10);
figure(1)
hold on
y_eval = double(eval(subs(Y(i+1),t, t_vals)))
plot(t_vals, y_eval;
hold off plot, symbolique function MATLAB Answers — New Questions
plot several equation and extract vertices
How can I plot in the same graph this 4 linear equations ?
y = 1
y = -4x + 1
x=4
2x+5y = 23
It’s possible to extract algebraically vertexes of the quadrilateral picture?How can I plot in the same graph this 4 linear equations ?
y = 1
y = -4x + 1
x=4
2x+5y = 23
It’s possible to extract algebraically vertexes of the quadrilateral picture? How can I plot in the same graph this 4 linear equations ?
y = 1
y = -4x + 1
x=4
2x+5y = 23
It’s possible to extract algebraically vertexes of the quadrilateral picture? plot, vertex, equation MATLAB Answers — New Questions
Derivative of state ‘1’ in block ‘model4/PMSM /Integrator’ at time 1.09996 is not finite
Could you please help me to solve the following error.
I am triing to find integrl squer error for pi controller and get this error
Error using fun (line 16) Derivative of state ‘1’ in block ‘model4/PMSM /Integrator’ at time 1.09996 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)Could you please help me to solve the following error.
I am triing to find integrl squer error for pi controller and get this error
Error using fun (line 16) Derivative of state ‘1’ in block ‘model4/PMSM /Integrator’ at time 1.09996 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) Could you please help me to solve the following error.
I am triing to find integrl squer error for pi controller and get this error
Error using fun (line 16) Derivative of state ‘1’ in block ‘model4/PMSM /Integrator’ at time 1.09996 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances) simulink, power_electronics_control, power_conversion_control, electric_motor_control, control system, pi controllrt MATLAB Answers — New Questions
Variable frequency Square pulse – Simulink
Hi,
I would like to know how can I generate a variable frequency controlled square pulse with 50% duty cycle in Simulink? I wish to vary the frequency in the range of 2KHz to 5.5KHz. It would be nice if you guys could help me.
Thanks a ton!Hi,
I would like to know how can I generate a variable frequency controlled square pulse with 50% duty cycle in Simulink? I wish to vary the frequency in the range of 2KHz to 5.5KHz. It would be nice if you guys could help me.
Thanks a ton! Hi,
I would like to know how can I generate a variable frequency controlled square pulse with 50% duty cycle in Simulink? I wish to vary the frequency in the range of 2KHz to 5.5KHz. It would be nice if you guys could help me.
Thanks a ton! simulink, pulse generator, variable frequency MATLAB Answers — New Questions
Add SINGLE element to array or vector
I have a vector of the format:
x = [xval(1) xval(2) … xval(n)]
, and I want to add an element to the end, xval(n+1). How do I do that?I have a vector of the format:
x = [xval(1) xval(2) … xval(n)]
, and I want to add an element to the end, xval(n+1). How do I do that? I have a vector of the format:
x = [xval(1) xval(2) … xval(n)]
, and I want to add an element to the end, xval(n+1). How do I do that? append valur to vector, deep learning MATLAB Answers — New Questions