Category: News
I got not logic current from motor which value from numbers suddenly 0 value. I think I have problem with the connection but still cannot find the mistake
Above, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltageAbove, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltage Above, This is my model simulink
this my current from motor .
I think i having wrong connection from Dc motor,H-bridge,controlled pwm voltage ev, simulink, battery, plot MATLAB Answers — New Questions
Error when using exportgraphics function to save large vector graphics with transparency
When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason?When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason? When I tried to save a large vector graphic with transparency information using the exportgraphics function on my PC, an error occurred.
MATLAB version: 9.12.0.2529717 (R2022a) Update 8
Operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Java version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
After plotting a large 3D vector graphic with complex perspectives and transparency relationships in a figure, I attempted to run the following code to save the figure:
exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’)
However, the program threw an error.
The error message was:
Problem while processing in an OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
com.mathworks.hg.util.OutputHelperProcessingException: Problem while processing in an
OutputHelper. java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:245)
Caused by: com.mathworks.hg.print.OutputProcessingException: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:144)
at com.mathworks.hg.util.HGVectorOutputHelper.close(HGVectorOutputHelper.java:241)
Caused by: java.nio.file.NoSuchFileException:
C:Usersroom250AppDataLocalTempemf6382030724281275533.tmp
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.copy(Files.java:3068)
at com.mathworks.hg.print.MWEMFVectorStrategy.endJob(MWEMFVectorStrategy.java:142)
… 1 more
I tried running MATLAB as an administrator and on a PC with higher memory, but the error persisted, and the error message remained the same. In addition, I checked the available storage space on my computer, and I have at least 390 GB of free space.
When I saved the same figure without transparency information as an image (using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘image’)), the exportgraphics function worked correctly.
Furthermore, I plotted a smaller image and tried again to save it using exportgraphics(gca, ‘picture1.emf’, ‘BackgroundColor’, ‘none’, ‘ContentType’, ‘vector’), and the result was correct.
So, it seems that the exportgraphics function may not support saving larger images, or is there another reason? exportgraphics, error MATLAB Answers — New Questions
Help with assessing learners work
Hi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
endHi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
end Hi All,
I am trying to assess students work for a reference solution below, but the problem is that when one thing is wrong, it is marking everything as wrong even though some elements of the learner’s code are correct. For example, say, UTM is correct but RREF is wrong, the assessment will also assess UTM as wrong. Is there a way I can fix this
function [AI UTM RREF INVA] = ROINVERSE(A)
%% Step 1: Matrix Validation
% Establish the Size of the Matrix [m n]
[m n] = size (A) ;
% Check if the Matrix is Square
if m~=n
error(‘Matrix Is Not Square’) ;
% Check Matrix For Singularity
elseif det(A) == 0
error(‘Matrix Is Not Invertible Since |A|=0’) ;
% Inform The User The Matrix Can Be Inverted
else
disp(‘The Matrix Is Invertible’) ;
end
%% Step 2: Augmented Matrix AI
AI = [A eye(m)] ;
%% Step 3: Upper Triangular Matrix UTM
UTM = AI ;
for i = 1:m
% Making All The Pivots = 1
UTM(i,:) = UTM(i,:)./UTM(i,i)
for j = i+1:n
% Making Values Below Pivots Equal to Zero
UTM(j,:) = UTM(j,:)-UTM(j,i)*UTM(i,:)
end
end
%% Step 4: Reduced Row Echelon Form RREF
RREF = UTM ;
for k = 1:(m-1)
for l = k+1:n
RREF(k,:) = RREF(k,:)-RREF(k,l)*RREF(l,:)
end
end
%% Step 5: Extract The Inverse Matrix INVA
INVA = RREF(1:m,(n+1):end)
end matlab grader, assessments MATLAB Answers — New Questions
How plot density of function ?
i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2 i search for finding i have a function which i saw the density plot i want plot the same i need density plot like the picture
for this function
0.3200000000e1 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) – 0.5120000000e1 * x ^ 2 / ((0.4000000000e0 * x – 0.8e0) ^ 2 + (0.8e0 * x + 0.4e0) ^ 2 + 0.12e1) ^ 2 plotting MATLAB Answers — New Questions
How to change my y-axis?
I want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middleI want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middle I want to change my y-axis so in the below from 0 to 100, and why my result give me the square (like grid) in the middle legend, axis MATLAB Answers — New Questions
How do I disable the (new) simulink zoom overview?
The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it?The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it? The bottom left corner of our simulink window is now occupied by this new overlay while zooming/panning around.
I wish to disable this as the overlay is more annoying than helpful to me.
How do I get rid of it? zoom, overview, navigate, pan, scoll, scale MATLAB Answers — New Questions
Use WLTC drive cycle data instead of step input
I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated!I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated! I’m currently working with the PMSM thermal model. I replaced the input speed (RPM) with custom WLTC speed data, specifically the first 50 points of the WLTC profile. I adjusted the simulation time to 50 seconds accordingly. I also interpolated my data to have a time interval of 0.01 seconds, and I verified the input RPM values using a plot—everything appears normal.
However, I encountered the following issues:
Torque Not Measured: In the simulation results , the demanded and achieved torques are not being measured.
Temperature Explosion: After around 10 seconds into the simulation, the motor temperature exhibits an unexpected and unrealistic spike or explosion.
I’ve carefully checked the input RPM data, and everything seems fine. What could be causing these issues? How can I resolve the torque measurement issue and fix the temperature explosion problem?
Any help or suggestions would be greatly appreciated! pmsm, simulink, pmsm thermal model MATLAB Answers — New Questions
Reconstructing signal using the IFFT
Hello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniquesHello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniques Hello, I am using the FFt to convert a time series signal into images by reshaping the matrix (N*N). But i am having hard time to get the original signal back from the images. IS it because in fft i am considering only the magnitude of the signal not the phase of the signal ? Is there any way to solve this proble. May be using STFT ot any kind of other techniques fft, ifft MATLAB Answers — New Questions
How to plot a function using gradient descent method?
— – #optimisation, #convex optimization, #gradient descent method, —obviously homework— MATLAB Answers — New Questions
BOOSTXL-DRV8320H interface with LaunchXL-F280049C
Dear Community,
I am using custom driver board which have BOOSTXL-DRV8320H and wants interface with LAUNCHXL-F280049C for BLDC Senseless motor.
I am refering this example >>openExample(‘mcb/SensorlessFocFOSMOExample’)
Does DRV8320H needs any driver code to integrate with Matlab code?
How to set nFAULT condition to observe fault?
What should be the interface required for hardware connection?
What should be the standard deadband limit ePWM. Currently RED,FED set to 15 period cycle.
Is there any way to observe these PWM waveforms?
Thanks.Dear Community,
I am using custom driver board which have BOOSTXL-DRV8320H and wants interface with LAUNCHXL-F280049C for BLDC Senseless motor.
I am refering this example >>openExample(‘mcb/SensorlessFocFOSMOExample’)
Does DRV8320H needs any driver code to integrate with Matlab code?
How to set nFAULT condition to observe fault?
What should be the interface required for hardware connection?
What should be the standard deadband limit ePWM. Currently RED,FED set to 15 period cycle.
Is there any way to observe these PWM waveforms?
Thanks. Dear Community,
I am using custom driver board which have BOOSTXL-DRV8320H and wants interface with LAUNCHXL-F280049C for BLDC Senseless motor.
I am refering this example >>openExample(‘mcb/SensorlessFocFOSMOExample’)
Does DRV8320H needs any driver code to integrate with Matlab code?
How to set nFAULT condition to observe fault?
What should be the interface required for hardware connection?
What should be the standard deadband limit ePWM. Currently RED,FED set to 15 period cycle.
Is there any way to observe these PWM waveforms?
Thanks. motor control blockset, bldc MATLAB Answers — New Questions
problem in integrating pre trined ANN regression model in appdesigner
Hi
i want to use a pre trained ANN regression model in the app designer, but i did not find out how to do that.
any help…Hi
i want to use a pre trained ANN regression model in the app designer, but i did not find out how to do that.
any help… Hi
i want to use a pre trained ANN regression model in the app designer, but i did not find out how to do that.
any help… kojiro saito MATLAB Answers — New Questions
How can I get the coefficients using the fir filter and hamming window in y = decimate(x,r,”fir”) , so I can simulate this function output in another program?
In using this function in matlab y = decimate(x,r,"fir"), I have got an output that I want to create in another program without using matlab. Where can I get the specs, coefficients, and weights to replicate this fir filter and hamming window?In using this function in matlab y = decimate(x,r,"fir"), I have got an output that I want to create in another program without using matlab. Where can I get the specs, coefficients, and weights to replicate this fir filter and hamming window? In using this function in matlab y = decimate(x,r,"fir"), I have got an output that I want to create in another program without using matlab. Where can I get the specs, coefficients, and weights to replicate this fir filter and hamming window? fir filter, hamming window, decimate MATLAB Answers — New Questions
app designer Control chart-How to construct shewhart control charts in app designer?
Hi all,
can any one suggest me, how to use "controlchart" function in appdesigner?Hi all,
can any one suggest me, how to use "controlchart" function in appdesigner? Hi all,
can any one suggest me, how to use "controlchart" function in appdesigner? app designer, control chart, shewhart control charts, statistics tool box MATLAB Answers — New Questions
Problem in exporting function expression
Dear all
I get a function cd(x,y).I would like to export this function expression like this form:x^2+y^3… .What shall I do?
Part of a function expression:Dear all
I get a function cd(x,y).I would like to export this function expression like this form:x^2+y^3… .What shall I do?
Part of a function expression: Dear all
I get a function cd(x,y).I would like to export this function expression like this form:x^2+y^3… .What shall I do?
Part of a function expression: export, function, save, fprintf, print MATLAB Answers — New Questions
Link external program (HEC HMS) and optimize the parameters using Matlab
I want to automate my calibration and validation process in my hydrological model (HEC HMS). I want to do optimization code in matlab, where it can reiterate the parameters until it achieve the best error index. I already have a setup of the HMS model on my area, I am on the process of calibrating my parameters.I want to automate my calibration and validation process in my hydrological model (HEC HMS). I want to do optimization code in matlab, where it can reiterate the parameters until it achieve the best error index. I already have a setup of the HMS model on my area, I am on the process of calibrating my parameters. I want to automate my calibration and validation process in my hydrological model (HEC HMS). I want to do optimization code in matlab, where it can reiterate the parameters until it achieve the best error index. I already have a setup of the HMS model on my area, I am on the process of calibrating my parameters. hydrology, hec, hms, hec hms, optimization, external program MATLAB Answers — New Questions
Why do we have to provide the jacobians at the Non-linear MPC of Matlab?
Hello,
this is more of a theory question but I would greatly appreciate if you could cite good sources with the theory behind my following question:
Why do we have to define (either numerically or analytically) the jacobians for the NMPC in Matlab?
I can understand that the Jacobian for the A, B and C matrices are for the linearization of the prediction model, but I don’t really understand why we need Jacobians for the Cost function and the Constraints as well.Hello,
this is more of a theory question but I would greatly appreciate if you could cite good sources with the theory behind my following question:
Why do we have to define (either numerically or analytically) the jacobians for the NMPC in Matlab?
I can understand that the Jacobian for the A, B and C matrices are for the linearization of the prediction model, but I don’t really understand why we need Jacobians for the Cost function and the Constraints as well. Hello,
this is more of a theory question but I would greatly appreciate if you could cite good sources with the theory behind my following question:
Why do we have to define (either numerically or analytically) the jacobians for the NMPC in Matlab?
I can understand that the Jacobian for the A, B and C matrices are for the linearization of the prediction model, but I don’t really understand why we need Jacobians for the Cost function and the Constraints as well. nmpc MATLAB Answers — New Questions
run Simscape HDL Workflow Advisor from script
Hi
I am currently working on automating my workflow with Simscape and the HDL Coder. Unfortunately, I cannot find an option to run and configure the Simscape HDL Workflow Advisor (sschdladvisor) from the command line. Is there any way to do this?
Thanks
MarcoHi
I am currently working on automating my workflow with Simscape and the HDL Coder. Unfortunately, I cannot find an option to run and configure the Simscape HDL Workflow Advisor (sschdladvisor) from the command line. Is there any way to do this?
Thanks
Marco Hi
I am currently working on automating my workflow with Simscape and the HDL Coder. Unfortunately, I cannot find an option to run and configure the Simscape HDL Workflow Advisor (sschdladvisor) from the command line. Is there any way to do this?
Thanks
Marco simscape, hdl-coder, workflow advisor MATLAB Answers — New Questions
why i can’t get same plot when i change Real to Im?
i plot the real one but when i change the plot for abs i can get the abs why i can’t get that of this function
0.2e1 * (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 * exp((-27 * t + 3 * x)) + 0.25e2 * exp((-35 * t + 5 * x + 2))) / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 * exp((-8 * t + 2 * x)) + 0.3e1 * exp((-27 * t + 3 * x)) + 0.5e1 * exp((-35 * t + 5 * x + 2))) ^ 2 / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) ^ 2
and my code for ploting is
abs(0.2e1 .* (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 .* exp((-27 * t + 3 * x)) + 0.25e2 .* exp((-35 * t + 5 * x + 2))) ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 .* exp((-8 * t + 2 * x)) + 0.3e1 .* exp((-27 * t + 3 * x)) + 0.5e1 .* exp((-35 * t + 5 * x + 2))) .^ 2 ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 .* x)) + exp((-35 * t + 5 * x + 2))) .^ 2).^2i plot the real one but when i change the plot for abs i can get the abs why i can’t get that of this function
0.2e1 * (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 * exp((-27 * t + 3 * x)) + 0.25e2 * exp((-35 * t + 5 * x + 2))) / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 * exp((-8 * t + 2 * x)) + 0.3e1 * exp((-27 * t + 3 * x)) + 0.5e1 * exp((-35 * t + 5 * x + 2))) ^ 2 / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) ^ 2
and my code for ploting is
abs(0.2e1 .* (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 .* exp((-27 * t + 3 * x)) + 0.25e2 .* exp((-35 * t + 5 * x + 2))) ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 .* exp((-8 * t + 2 * x)) + 0.3e1 .* exp((-27 * t + 3 * x)) + 0.5e1 .* exp((-35 * t + 5 * x + 2))) .^ 2 ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 .* x)) + exp((-35 * t + 5 * x + 2))) .^ 2).^2 i plot the real one but when i change the plot for abs i can get the abs why i can’t get that of this function
0.2e1 * (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 * exp((-27 * t + 3 * x)) + 0.25e2 * exp((-35 * t + 5 * x + 2))) / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 * exp((-8 * t + 2 * x)) + 0.3e1 * exp((-27 * t + 3 * x)) + 0.5e1 * exp((-35 * t + 5 * x + 2))) ^ 2 / (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) ^ 2
and my code for ploting is
abs(0.2e1 .* (0.4e1 * exp((-8 * t + 2 * x)) + 0.9e1 .* exp((-27 * t + 3 * x)) + 0.25e2 .* exp((-35 * t + 5 * x + 2))) ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 * x)) + exp((-35 * t + 5 * x + 2))) – 0.2e1 * (0.2e1 .* exp((-8 * t + 2 * x)) + 0.3e1 .* exp((-27 * t + 3 * x)) + 0.5e1 .* exp((-35 * t + 5 * x + 2))) .^ 2 ./ (exp(0.2e1) + exp((-8 * t + 2 * x)) + exp((-27 * t + 3 .* x)) + exp((-35 * t + 5 * x + 2))) .^ 2).^2 plotting, 3d plots MATLAB Answers — New Questions
Roadrunner: XML validation failed
an error occurs when trying to export as xodr file.an error occurs when trying to export as xodr file. an error occurs when trying to export as xodr file. export, xml, xodr MATLAB Answers — New Questions
Opening text document and sending the info over serial port
I have a text document, called transition.txt, that has this inside it.
L,R,D’,B,U,D,F’,R,B’,L’,B2,R,F2,D2,F,L’,U2,L,U2,L,B2,L’,B2,L2,U2,L2,R2,U2,B2,U2
I need to send it to my arduino. Not sure what the code should do on the Matlab side. Also, how would I make sure the information got to the arduino in the way I wanted it to?
Here is my arduino code.
const size_t maxCommandNumber = 50;
const size_t maxCommandSize = 3 * maxCommandNumber; // if commands fit on 2 characters and a comma, this is enough for maxCommandNumber commands
char receivedChars[maxCommandSize + 1]; // +1 for trailing null char required by cStrings
const char endMarker = ‘n’;
void func_L(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Lp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_L2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Rp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Dp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Bp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Up(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Fp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_unknown(const char* s) {Serial.print(F("Unknown commmand: ")); Serial.println(s);}
struct {
const char* label;
void (*func)(const char*);
} keys[] = {
{"L", func_L},
{"L’", func_Lp},
{"L2", func_L2},
{"R", func_R},
{"R’", func_Rp},
{"R2", func_R2},
{"D", func_D},
{"D’", func_Dp},
{"D2", func_D2},
{"B", func_B},
{"B’", func_Bp},
{"B2", func_B2},
{"U", func_U},
{"U’", func_Up},
{"U2", func_U2},
{"F", func_F},
{"F’", func_Fp},
{"F2", func_F2},
};
const size_t nbKeys = sizeof keys / sizeof keys[0];
bool findAndExecute(const char* s)
{
bool success = false;
for (size_t i = 0; i < nbKeys; i++)
if (!strcmp(s, keys[i].label)) {
keys[i].func(s);
success = true;
break;
}
if (!success) func_unknown(s);
return success;
}
bool commandAvailable()
{
static size_t commandIndex = 0;
static bool awaitEndMarkerError = false;
int incomingByte = Serial.read();
bool commandComplete = false;
if (incomingByte != -1) { // read returns -1 if there is nothing to read (faster than using available)
if (awaitEndMarkerError) {
if (incomingByte == endMarker) {
awaitEndMarkerError = false;
commandIndex = 0;
receivedChars[0] = ”; // discard what was there
commandComplete = true; // if we want to still notify the parser we got a command (here will be empty)
}
} else {
char incomingCharacter = incomingByte; // grab LSB as a char
if (incomingByte != endMarker) {
if (commandIndex < maxCommandSize) {
if (!isspace(incomingCharacter)) { // discard all spaces. could also add a test to only keep A-Z and ‘ and 2, whatever is legit in the command language
receivedChars[commandIndex++] = incomingCharacter;
receivedChars[commandIndex] = ”; // always maintain a correct cString
}
} else {
Serial.println(F("ERROR: Command line too big. Discarded.nt-> increase maxCommandNumber or send shorter command lines."));
awaitEndMarkerError = true;
}
} else {
commandIndex = 0;
commandComplete = true;
}
}
}
return commandComplete;
}
bool handleCommand()
{
bool success = true;
const char* separators = ",";
Serial.print(F("nparsing : ")); Serial.println(receivedChars);
char* ptr = strtok(receivedChars, separators);
if (*ptr == ”) Serial.println(F("Error: empty command"));
else
while (ptr) {
success &= findAndExecute(ptr);
ptr = strtok(NULL, separators);
}
return success;
}
void setup() {
Serial.begin(115200);
}
void loop() {
if (commandAvailable())
if (! handleCommand())
Serial.println(F("Some commands were not recognized"));
}I have a text document, called transition.txt, that has this inside it.
L,R,D’,B,U,D,F’,R,B’,L’,B2,R,F2,D2,F,L’,U2,L,U2,L,B2,L’,B2,L2,U2,L2,R2,U2,B2,U2
I need to send it to my arduino. Not sure what the code should do on the Matlab side. Also, how would I make sure the information got to the arduino in the way I wanted it to?
Here is my arduino code.
const size_t maxCommandNumber = 50;
const size_t maxCommandSize = 3 * maxCommandNumber; // if commands fit on 2 characters and a comma, this is enough for maxCommandNumber commands
char receivedChars[maxCommandSize + 1]; // +1 for trailing null char required by cStrings
const char endMarker = ‘n’;
void func_L(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Lp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_L2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Rp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Dp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Bp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Up(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Fp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_unknown(const char* s) {Serial.print(F("Unknown commmand: ")); Serial.println(s);}
struct {
const char* label;
void (*func)(const char*);
} keys[] = {
{"L", func_L},
{"L’", func_Lp},
{"L2", func_L2},
{"R", func_R},
{"R’", func_Rp},
{"R2", func_R2},
{"D", func_D},
{"D’", func_Dp},
{"D2", func_D2},
{"B", func_B},
{"B’", func_Bp},
{"B2", func_B2},
{"U", func_U},
{"U’", func_Up},
{"U2", func_U2},
{"F", func_F},
{"F’", func_Fp},
{"F2", func_F2},
};
const size_t nbKeys = sizeof keys / sizeof keys[0];
bool findAndExecute(const char* s)
{
bool success = false;
for (size_t i = 0; i < nbKeys; i++)
if (!strcmp(s, keys[i].label)) {
keys[i].func(s);
success = true;
break;
}
if (!success) func_unknown(s);
return success;
}
bool commandAvailable()
{
static size_t commandIndex = 0;
static bool awaitEndMarkerError = false;
int incomingByte = Serial.read();
bool commandComplete = false;
if (incomingByte != -1) { // read returns -1 if there is nothing to read (faster than using available)
if (awaitEndMarkerError) {
if (incomingByte == endMarker) {
awaitEndMarkerError = false;
commandIndex = 0;
receivedChars[0] = ”; // discard what was there
commandComplete = true; // if we want to still notify the parser we got a command (here will be empty)
}
} else {
char incomingCharacter = incomingByte; // grab LSB as a char
if (incomingByte != endMarker) {
if (commandIndex < maxCommandSize) {
if (!isspace(incomingCharacter)) { // discard all spaces. could also add a test to only keep A-Z and ‘ and 2, whatever is legit in the command language
receivedChars[commandIndex++] = incomingCharacter;
receivedChars[commandIndex] = ”; // always maintain a correct cString
}
} else {
Serial.println(F("ERROR: Command line too big. Discarded.nt-> increase maxCommandNumber or send shorter command lines."));
awaitEndMarkerError = true;
}
} else {
commandIndex = 0;
commandComplete = true;
}
}
}
return commandComplete;
}
bool handleCommand()
{
bool success = true;
const char* separators = ",";
Serial.print(F("nparsing : ")); Serial.println(receivedChars);
char* ptr = strtok(receivedChars, separators);
if (*ptr == ”) Serial.println(F("Error: empty command"));
else
while (ptr) {
success &= findAndExecute(ptr);
ptr = strtok(NULL, separators);
}
return success;
}
void setup() {
Serial.begin(115200);
}
void loop() {
if (commandAvailable())
if (! handleCommand())
Serial.println(F("Some commands were not recognized"));
} I have a text document, called transition.txt, that has this inside it.
L,R,D’,B,U,D,F’,R,B’,L’,B2,R,F2,D2,F,L’,U2,L,U2,L,B2,L’,B2,L2,U2,L2,R2,U2,B2,U2
I need to send it to my arduino. Not sure what the code should do on the Matlab side. Also, how would I make sure the information got to the arduino in the way I wanted it to?
Here is my arduino code.
const size_t maxCommandNumber = 50;
const size_t maxCommandSize = 3 * maxCommandNumber; // if commands fit on 2 characters and a comma, this is enough for maxCommandNumber commands
char receivedChars[maxCommandSize + 1]; // +1 for trailing null char required by cStrings
const char endMarker = ‘n’;
void func_L(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Lp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_L2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Rp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_R2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Dp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_D2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Bp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_B2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Up(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_U2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_Fp(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_F2(const char* s) {Serial.print(F("in Function ")); Serial.println(s);}
void func_unknown(const char* s) {Serial.print(F("Unknown commmand: ")); Serial.println(s);}
struct {
const char* label;
void (*func)(const char*);
} keys[] = {
{"L", func_L},
{"L’", func_Lp},
{"L2", func_L2},
{"R", func_R},
{"R’", func_Rp},
{"R2", func_R2},
{"D", func_D},
{"D’", func_Dp},
{"D2", func_D2},
{"B", func_B},
{"B’", func_Bp},
{"B2", func_B2},
{"U", func_U},
{"U’", func_Up},
{"U2", func_U2},
{"F", func_F},
{"F’", func_Fp},
{"F2", func_F2},
};
const size_t nbKeys = sizeof keys / sizeof keys[0];
bool findAndExecute(const char* s)
{
bool success = false;
for (size_t i = 0; i < nbKeys; i++)
if (!strcmp(s, keys[i].label)) {
keys[i].func(s);
success = true;
break;
}
if (!success) func_unknown(s);
return success;
}
bool commandAvailable()
{
static size_t commandIndex = 0;
static bool awaitEndMarkerError = false;
int incomingByte = Serial.read();
bool commandComplete = false;
if (incomingByte != -1) { // read returns -1 if there is nothing to read (faster than using available)
if (awaitEndMarkerError) {
if (incomingByte == endMarker) {
awaitEndMarkerError = false;
commandIndex = 0;
receivedChars[0] = ”; // discard what was there
commandComplete = true; // if we want to still notify the parser we got a command (here will be empty)
}
} else {
char incomingCharacter = incomingByte; // grab LSB as a char
if (incomingByte != endMarker) {
if (commandIndex < maxCommandSize) {
if (!isspace(incomingCharacter)) { // discard all spaces. could also add a test to only keep A-Z and ‘ and 2, whatever is legit in the command language
receivedChars[commandIndex++] = incomingCharacter;
receivedChars[commandIndex] = ”; // always maintain a correct cString
}
} else {
Serial.println(F("ERROR: Command line too big. Discarded.nt-> increase maxCommandNumber or send shorter command lines."));
awaitEndMarkerError = true;
}
} else {
commandIndex = 0;
commandComplete = true;
}
}
}
return commandComplete;
}
bool handleCommand()
{
bool success = true;
const char* separators = ",";
Serial.print(F("nparsing : ")); Serial.println(receivedChars);
char* ptr = strtok(receivedChars, separators);
if (*ptr == ”) Serial.println(F("Error: empty command"));
else
while (ptr) {
success &= findAndExecute(ptr);
ptr = strtok(NULL, separators);
}
return success;
}
void setup() {
Serial.begin(115200);
}
void loop() {
if (commandAvailable())
if (! handleCommand())
Serial.println(F("Some commands were not recognized"));
} arduino, serial, send MATLAB Answers — New Questions