Tag Archives: matlab
Why License Manager Error -9,57 if the username MatLicence/Window is the same?
Why License Manager Error -9,57 if the username MatLicence/Window is the same?Why License Manager Error -9,57 if the username MatLicence/Window is the same? Why License Manager Error -9,57 if the username MatLicence/Window is the same? licence, matlab MATLAB Answers — New Questions
How can I fix my Runge Kutta (4th order) method to solve a 2nd order ODE?
solve x”(t) +δx'(t) + αx(t) + βx(t)^3 = γcos(ωt), x(0)=0 , x'(0)=0
clc
clear;
h=1;
delta = 0.1;
alpha = -1;
beta = 0.25;
gamma = 2.5;
omega = 2;
t(1)=0;
z(1)=0;
x(1)=0;
d=(gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z)
g=@(t,x,z) z;
f=@(t,x,z) (gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z);
for i=1:50
L1 = h*g(t, x, z);
k1 = h*f(t, x, z);
L2 = h*g(t+h/2, x+k1/2, z+L1/2);
k2 = h*f(t+h/2, x+k1/2, z+L1/2);
L3 = h*g(t+h/2, x+k2/2, z+L2/2);
k3 = h*f(t+h/2, x+k2/2, z+L2/2);
L4 = h*g(t+h, x+k3, z+L3);
k4 = h*f(t+h, x+k3, z+L3);
z = z + (L1+2*L2+2*L3+L4)/6;
x = x + (L1+2*L2+2*L3+L4)/6;
t= t+h;
fprintf(‘i=%8.0f, t=%8.2f, x=%8.6f, z=%8.6fn’,i,t,x,z)
plot(t,z,’-*r’)
hold on
plot(t,x,’-ob’)
endsolve x”(t) +δx'(t) + αx(t) + βx(t)^3 = γcos(ωt), x(0)=0 , x'(0)=0
clc
clear;
h=1;
delta = 0.1;
alpha = -1;
beta = 0.25;
gamma = 2.5;
omega = 2;
t(1)=0;
z(1)=0;
x(1)=0;
d=(gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z)
g=@(t,x,z) z;
f=@(t,x,z) (gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z);
for i=1:50
L1 = h*g(t, x, z);
k1 = h*f(t, x, z);
L2 = h*g(t+h/2, x+k1/2, z+L1/2);
k2 = h*f(t+h/2, x+k1/2, z+L1/2);
L3 = h*g(t+h/2, x+k2/2, z+L2/2);
k3 = h*f(t+h/2, x+k2/2, z+L2/2);
L4 = h*g(t+h, x+k3, z+L3);
k4 = h*f(t+h, x+k3, z+L3);
z = z + (L1+2*L2+2*L3+L4)/6;
x = x + (L1+2*L2+2*L3+L4)/6;
t= t+h;
fprintf(‘i=%8.0f, t=%8.2f, x=%8.6f, z=%8.6fn’,i,t,x,z)
plot(t,z,’-*r’)
hold on
plot(t,x,’-ob’)
end solve x”(t) +δx'(t) + αx(t) + βx(t)^3 = γcos(ωt), x(0)=0 , x'(0)=0
clc
clear;
h=1;
delta = 0.1;
alpha = -1;
beta = 0.25;
gamma = 2.5;
omega = 2;
t(1)=0;
z(1)=0;
x(1)=0;
d=(gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z)
g=@(t,x,z) z;
f=@(t,x,z) (gamma*(cos(omega*t)))-(beta*(x^3))-(alpha*x)-(delta*z);
for i=1:50
L1 = h*g(t, x, z);
k1 = h*f(t, x, z);
L2 = h*g(t+h/2, x+k1/2, z+L1/2);
k2 = h*f(t+h/2, x+k1/2, z+L1/2);
L3 = h*g(t+h/2, x+k2/2, z+L2/2);
k3 = h*f(t+h/2, x+k2/2, z+L2/2);
L4 = h*g(t+h, x+k3, z+L3);
k4 = h*f(t+h, x+k3, z+L3);
z = z + (L1+2*L2+2*L3+L4)/6;
x = x + (L1+2*L2+2*L3+L4)/6;
t= t+h;
fprintf(‘i=%8.0f, t=%8.2f, x=%8.6f, z=%8.6fn’,i,t,x,z)
plot(t,z,’-*r’)
hold on
plot(t,x,’-ob’)
end matlab, differential equations MATLAB Answers — New Questions
在matlab function中导入net,但是出现了以下问题,尝试过6.3和8.1版本的MinG64,但是一直报错。Deep learning code generation using MinGW64 Compiler (C++) toolchain is not supported for mkldnn target.
Post Content Post Content mingw64, mkldnn MATLAB Answers — New Questions
How to implement RIS(reconfigurable intelligent surface) in a FSO using gamma-gamma channel in MATLAB?
whats the MATLAB code for implementing this?whats the MATLAB code for implementing this? whats the MATLAB code for implementing this? wireless, fso, ris, communication, digital signal processing MATLAB Answers — New Questions
Can spectrumAnalyzer show the power level of complex I&Q signal?
I created a complex linear frequency modulated Chirp signal (constant envelop) anad complex noise. When I use spectrumAnalyzer within the MATLAB live script, it shows non-constant spectrum. Is there a way to show complex signal’s power and noise?
% For repeatable simulations, set the random number generator to default
rng default;
noisesigI = wgn(numSamples,1,10*log10(N))’;
noisesigQ = wgn(numSamples,1,10*log10(N))’;
noisesig = 1/(sqrt(2))*complex(noisesigI,noisesigQ);
rxwaveform = (scaledsig + noisesig);
% Scale the received signal for having unit power
Scaled_rxwaveform = rxwaveform/rms(rxwaveform);
ShowVisualizations =1;
if ShowVisualizations == 1
rxscope = spectrumAnalyzer(SampleRate = baseFs, …
PlotAsTwoSidedSpectrum = true, …
SpectrumType = "Power", …
SpectrumUnits = "dBW", …
Title = "Received signal BB UDC + Noise spectrum");
rxscope(rxwaveform’, noisesig’,scaledsig’); %scope accepts only column vec.
endI created a complex linear frequency modulated Chirp signal (constant envelop) anad complex noise. When I use spectrumAnalyzer within the MATLAB live script, it shows non-constant spectrum. Is there a way to show complex signal’s power and noise?
% For repeatable simulations, set the random number generator to default
rng default;
noisesigI = wgn(numSamples,1,10*log10(N))’;
noisesigQ = wgn(numSamples,1,10*log10(N))’;
noisesig = 1/(sqrt(2))*complex(noisesigI,noisesigQ);
rxwaveform = (scaledsig + noisesig);
% Scale the received signal for having unit power
Scaled_rxwaveform = rxwaveform/rms(rxwaveform);
ShowVisualizations =1;
if ShowVisualizations == 1
rxscope = spectrumAnalyzer(SampleRate = baseFs, …
PlotAsTwoSidedSpectrum = true, …
SpectrumType = "Power", …
SpectrumUnits = "dBW", …
Title = "Received signal BB UDC + Noise spectrum");
rxscope(rxwaveform’, noisesig’,scaledsig’); %scope accepts only column vec.
end I created a complex linear frequency modulated Chirp signal (constant envelop) anad complex noise. When I use spectrumAnalyzer within the MATLAB live script, it shows non-constant spectrum. Is there a way to show complex signal’s power and noise?
% For repeatable simulations, set the random number generator to default
rng default;
noisesigI = wgn(numSamples,1,10*log10(N))’;
noisesigQ = wgn(numSamples,1,10*log10(N))’;
noisesig = 1/(sqrt(2))*complex(noisesigI,noisesigQ);
rxwaveform = (scaledsig + noisesig);
% Scale the received signal for having unit power
Scaled_rxwaveform = rxwaveform/rms(rxwaveform);
ShowVisualizations =1;
if ShowVisualizations == 1
rxscope = spectrumAnalyzer(SampleRate = baseFs, …
PlotAsTwoSidedSpectrum = true, …
SpectrumType = "Power", …
SpectrumUnits = "dBW", …
Title = "Received signal BB UDC + Noise spectrum");
rxscope(rxwaveform’, noisesig’,scaledsig’); %scope accepts only column vec.
end spectrumanalyzer, signal processing MATLAB Answers — New Questions
matlab recent versions editor left side white margin
Regarding the issue outlined in the following thread where the poster asks about the white margin on the left of the live editor:
https://in.mathworks.com/matlabcentral/answers/1596289-why-matlab-2021b-livescript-has-large-left-margin-column
The white margin on the left appears in the regular editor as well. See the image below. Not only is this white margin ugly but it is also inconvenient since you expect that you can backspace upto the start of the whitespace only to have the line prematurely deleted. Since it is not part of the editor, why not give a different shade to the margin. Every text editor that I have used has a border before the start of the first character and I think for good reason. If the margin is genuinely not part of the text box, it should be shaded differently.Regarding the issue outlined in the following thread where the poster asks about the white margin on the left of the live editor:
https://in.mathworks.com/matlabcentral/answers/1596289-why-matlab-2021b-livescript-has-large-left-margin-column
The white margin on the left appears in the regular editor as well. See the image below. Not only is this white margin ugly but it is also inconvenient since you expect that you can backspace upto the start of the whitespace only to have the line prematurely deleted. Since it is not part of the editor, why not give a different shade to the margin. Every text editor that I have used has a border before the start of the first character and I think for good reason. If the margin is genuinely not part of the text box, it should be shaded differently. Regarding the issue outlined in the following thread where the poster asks about the white margin on the left of the live editor:
https://in.mathworks.com/matlabcentral/answers/1596289-why-matlab-2021b-livescript-has-large-left-margin-column
The white margin on the left appears in the regular editor as well. See the image below. Not only is this white margin ugly but it is also inconvenient since you expect that you can backspace upto the start of the whitespace only to have the line prematurely deleted. Since it is not part of the editor, why not give a different shade to the margin. Every text editor that I have used has a border before the start of the first character and I think for good reason. If the margin is genuinely not part of the text box, it should be shaded differently. editor, left margin, whitespace MATLAB Answers — New Questions
Flight Log Analyzer Error in extracting GPS and Attitude Data
Hello, I am trying to import a ulog file from a PX4 SITL flight of a UAV performed in Qgrouncontrol. The ulog file works fine and the GPS data and everything else is available when I use the PX4 online flight reviewer (https://review.px4.io/plot_app?log=b0a85256-2690-49bb-8b93-a76311c32c86), however, when I try importing the downloaded ulog file (top right on page you can download it as well), the flight log analyzer app does not display any 2D map. It lists the flight modes and their timestamps, but when I hover over the map view, I get a "Error in extracting GPS and Attitude Data" message.
When importing the ulog from into the workspace using ulogreader there is a long list of topics, and the GPS position seems to be included, but when opening the signal browser after importing the ulog file into the flight log analyzer, many of the topics seem to not have been imported?
Importing the ulog file from the tutorial works, so I am assuming that there is something wrong with my ulog file format/the way the flight analyzer is trying to read the message fields, but I am unsure what exactly the problem is. If anyone has any ideas please let me know
This is the version of Matlab I am running:
MATLAB Version: 24.1.0.2603908 (R2024a) Update 3
Operating System: Microsoft Windows 11 Home Single Language Version 10.0 (Build 22631)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 24.1 (R2024a)
Simulink Version 24.1 (R2024a)
Mapping Toolbox Version 24.1 (R2024a)
Signal Processing Toolbox Version 24.1 (R2024a)
UAV Toolbox Version 24.1 (R2024a)Hello, I am trying to import a ulog file from a PX4 SITL flight of a UAV performed in Qgrouncontrol. The ulog file works fine and the GPS data and everything else is available when I use the PX4 online flight reviewer (https://review.px4.io/plot_app?log=b0a85256-2690-49bb-8b93-a76311c32c86), however, when I try importing the downloaded ulog file (top right on page you can download it as well), the flight log analyzer app does not display any 2D map. It lists the flight modes and their timestamps, but when I hover over the map view, I get a "Error in extracting GPS and Attitude Data" message.
When importing the ulog from into the workspace using ulogreader there is a long list of topics, and the GPS position seems to be included, but when opening the signal browser after importing the ulog file into the flight log analyzer, many of the topics seem to not have been imported?
Importing the ulog file from the tutorial works, so I am assuming that there is something wrong with my ulog file format/the way the flight analyzer is trying to read the message fields, but I am unsure what exactly the problem is. If anyone has any ideas please let me know
This is the version of Matlab I am running:
MATLAB Version: 24.1.0.2603908 (R2024a) Update 3
Operating System: Microsoft Windows 11 Home Single Language Version 10.0 (Build 22631)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 24.1 (R2024a)
Simulink Version 24.1 (R2024a)
Mapping Toolbox Version 24.1 (R2024a)
Signal Processing Toolbox Version 24.1 (R2024a)
UAV Toolbox Version 24.1 (R2024a) Hello, I am trying to import a ulog file from a PX4 SITL flight of a UAV performed in Qgrouncontrol. The ulog file works fine and the GPS data and everything else is available when I use the PX4 online flight reviewer (https://review.px4.io/plot_app?log=b0a85256-2690-49bb-8b93-a76311c32c86), however, when I try importing the downloaded ulog file (top right on page you can download it as well), the flight log analyzer app does not display any 2D map. It lists the flight modes and their timestamps, but when I hover over the map view, I get a "Error in extracting GPS and Attitude Data" message.
When importing the ulog from into the workspace using ulogreader there is a long list of topics, and the GPS position seems to be included, but when opening the signal browser after importing the ulog file into the flight log analyzer, many of the topics seem to not have been imported?
Importing the ulog file from the tutorial works, so I am assuming that there is something wrong with my ulog file format/the way the flight analyzer is trying to read the message fields, but I am unsure what exactly the problem is. If anyone has any ideas please let me know
This is the version of Matlab I am running:
MATLAB Version: 24.1.0.2603908 (R2024a) Update 3
Operating System: Microsoft Windows 11 Home Single Language Version 10.0 (Build 22631)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 24.1 (R2024a)
Simulink Version 24.1 (R2024a)
Mapping Toolbox Version 24.1 (R2024a)
Signal Processing Toolbox Version 24.1 (R2024a)
UAV Toolbox Version 24.1 (R2024a) ulog, px4, qgrouncontrol, flightloganalyzer MATLAB Answers — New Questions
Matlab function “pyenv”
I need to convert one function from Matlab to Python. My Matlab version is R2022.b. Compatible Python version is 3.10. Both Matlab and Python are now installed on my PC. When I run the function "pyenv" in Matlab, I receive empty fields and message "Python commands require a supported version of CPython."
Regarding Matlab, I have: Matlab, Financial Toolbox, Optimization Toolbox, and Statistics and Machine Learning Toolbox.
Do I need to get some other toolboxes for Matlab to be able to see/work with Python?
Thank you.
StefanI need to convert one function from Matlab to Python. My Matlab version is R2022.b. Compatible Python version is 3.10. Both Matlab and Python are now installed on my PC. When I run the function "pyenv" in Matlab, I receive empty fields and message "Python commands require a supported version of CPython."
Regarding Matlab, I have: Matlab, Financial Toolbox, Optimization Toolbox, and Statistics and Machine Learning Toolbox.
Do I need to get some other toolboxes for Matlab to be able to see/work with Python?
Thank you.
Stefan I need to convert one function from Matlab to Python. My Matlab version is R2022.b. Compatible Python version is 3.10. Both Matlab and Python are now installed on my PC. When I run the function "pyenv" in Matlab, I receive empty fields and message "Python commands require a supported version of CPython."
Regarding Matlab, I have: Matlab, Financial Toolbox, Optimization Toolbox, and Statistics and Machine Learning Toolbox.
Do I need to get some other toolboxes for Matlab to be able to see/work with Python?
Thank you.
Stefan matlab to python, python MATLAB Answers — New Questions
syntax error in if else if block
how to write else if condition with multiple inputs
else if condition is throwing an error.how to write else if condition with multiple inputs
else if condition is throwing an error. how to write else if condition with multiple inputs
else if condition is throwing an error. if statement, error MATLAB Answers — New Questions
In this work, I am trying to connect two systems by injecting a delayed wave of the first system into the second system. In this system, there are several problems, including:
function [sol1] = two_system
clc
close all
clear all
global z; %%problems
%%1- The indices for the two systems cannot be equal.
%%2- The global function is only valid for one value of (MD) …
%%(the last value), while I need all values from the first system.
z= 0.05;
tau = 0.1;
tspan = linspace(0, 5, 300);
opt = odeset(‘RelTol’,1e-3);
sol1 = dde23(@system1,tau ,[0],tspan, opt);
[x1, y1] = ode23(@system2, tspan, [0], opt);
figure(1)
plot(sol1.x, sol1.y(1,:),’–r’,’LineWidth’,1.5)
hold on
plot(x1, y1(:,1),’b’,’LineWidth’,1.5)
L2=length(x1)
L1=length(sol1.x)
end
function dydt = system1(t,y,D)
global z MD;
M1 = y(1);
MD = D(1);
s1 = MD %for checking
F_M1= 2;
theta1=0*pi/180;
A1 = 0.01;
%%%%%%% equation_system1 %%%%%%%
dMdt=(A1*(2*pi*(F_M1))*cos(2*pi*(F_M1)*(t)+theta1));
dydt = [dMdt];
end
function dydt = system2(t,y)
global z MD;
s2=MD %% for checking
M2 = y(1);
F_M2= 2;
theta2=0*pi/180;
A2 = 0.01;
%%%%%%% equation_system2 %%%%%%%
dMdt=(A2*(2*pi*(F_M2))*cos(2*pi*(F_M2)*(t)+theta2))+MD*z;
dydt = [dMdt];
endfunction [sol1] = two_system
clc
close all
clear all
global z; %%problems
%%1- The indices for the two systems cannot be equal.
%%2- The global function is only valid for one value of (MD) …
%%(the last value), while I need all values from the first system.
z= 0.05;
tau = 0.1;
tspan = linspace(0, 5, 300);
opt = odeset(‘RelTol’,1e-3);
sol1 = dde23(@system1,tau ,[0],tspan, opt);
[x1, y1] = ode23(@system2, tspan, [0], opt);
figure(1)
plot(sol1.x, sol1.y(1,:),’–r’,’LineWidth’,1.5)
hold on
plot(x1, y1(:,1),’b’,’LineWidth’,1.5)
L2=length(x1)
L1=length(sol1.x)
end
function dydt = system1(t,y,D)
global z MD;
M1 = y(1);
MD = D(1);
s1 = MD %for checking
F_M1= 2;
theta1=0*pi/180;
A1 = 0.01;
%%%%%%% equation_system1 %%%%%%%
dMdt=(A1*(2*pi*(F_M1))*cos(2*pi*(F_M1)*(t)+theta1));
dydt = [dMdt];
end
function dydt = system2(t,y)
global z MD;
s2=MD %% for checking
M2 = y(1);
F_M2= 2;
theta2=0*pi/180;
A2 = 0.01;
%%%%%%% equation_system2 %%%%%%%
dMdt=(A2*(2*pi*(F_M2))*cos(2*pi*(F_M2)*(t)+theta2))+MD*z;
dydt = [dMdt];
end function [sol1] = two_system
clc
close all
clear all
global z; %%problems
%%1- The indices for the two systems cannot be equal.
%%2- The global function is only valid for one value of (MD) …
%%(the last value), while I need all values from the first system.
z= 0.05;
tau = 0.1;
tspan = linspace(0, 5, 300);
opt = odeset(‘RelTol’,1e-3);
sol1 = dde23(@system1,tau ,[0],tspan, opt);
[x1, y1] = ode23(@system2, tspan, [0], opt);
figure(1)
plot(sol1.x, sol1.y(1,:),’–r’,’LineWidth’,1.5)
hold on
plot(x1, y1(:,1),’b’,’LineWidth’,1.5)
L2=length(x1)
L1=length(sol1.x)
end
function dydt = system1(t,y,D)
global z MD;
M1 = y(1);
MD = D(1);
s1 = MD %for checking
F_M1= 2;
theta1=0*pi/180;
A1 = 0.01;
%%%%%%% equation_system1 %%%%%%%
dMdt=(A1*(2*pi*(F_M1))*cos(2*pi*(F_M1)*(t)+theta1));
dydt = [dMdt];
end
function dydt = system2(t,y)
global z MD;
s2=MD %% for checking
M2 = y(1);
F_M2= 2;
theta2=0*pi/180;
A2 = 0.01;
%%%%%%% equation_system2 %%%%%%%
dMdt=(A2*(2*pi*(F_M2))*cos(2*pi*(F_M2)*(t)+theta2))+MD*z;
dydt = [dMdt];
end sam chak MATLAB Answers — New Questions
Neural Network form Parameters to Simple Image Generation
Hello everyone,
I am currently working on a project where I need to generate black and white images of squares based on three parameters: the center x coordinate, the center y coordinate, and the edge length of the square. This would be extremely easy by itself but I must do it through e neural network or other type of ML approach. Below is a small example of a 10-samples dataset.
Could anyone provide guidance on how to design and train a neural network for this purpose? Specifically, I am looking for insights into:
Choosing the appropriate neural network architecture (e.g., convolutional neural network, feedforward neural network).
Preprocessing steps required for the input data.
Methods for structuring the output layer to generate the B/W image of the square.
Techniques for training the neural network using a dataset of square images with known parameters.
Any advice, sample code, or relevant resources would be greatly appreciated.
Thank you in advance for your assistance.
Best regards,
DanieleHello everyone,
I am currently working on a project where I need to generate black and white images of squares based on three parameters: the center x coordinate, the center y coordinate, and the edge length of the square. This would be extremely easy by itself but I must do it through e neural network or other type of ML approach. Below is a small example of a 10-samples dataset.
Could anyone provide guidance on how to design and train a neural network for this purpose? Specifically, I am looking for insights into:
Choosing the appropriate neural network architecture (e.g., convolutional neural network, feedforward neural network).
Preprocessing steps required for the input data.
Methods for structuring the output layer to generate the B/W image of the square.
Techniques for training the neural network using a dataset of square images with known parameters.
Any advice, sample code, or relevant resources would be greatly appreciated.
Thank you in advance for your assistance.
Best regards,
Daniele Hello everyone,
I am currently working on a project where I need to generate black and white images of squares based on three parameters: the center x coordinate, the center y coordinate, and the edge length of the square. This would be extremely easy by itself but I must do it through e neural network or other type of ML approach. Below is a small example of a 10-samples dataset.
Could anyone provide guidance on how to design and train a neural network for this purpose? Specifically, I am looking for insights into:
Choosing the appropriate neural network architecture (e.g., convolutional neural network, feedforward neural network).
Preprocessing steps required for the input data.
Methods for structuring the output layer to generate the B/W image of the square.
Techniques for training the neural network using a dataset of square images with known parameters.
Any advice, sample code, or relevant resources would be greatly appreciated.
Thank you in advance for your assistance.
Best regards,
Daniele neural network, image generation MATLAB Answers — New Questions
Merge two plots with the same y axis
Hello there,
I have two sets of parameter, x1 and x2 and they both vary with depth. Since the scale span of x1 is different to that of x2, what I want to do is to put the axis of x2 above, as the secondary plot (see fig below). Anyone can help me to fix this?
x1 = 0:0.1:5;
y1 = 0:1:50;
y2 = 0:1:90;
x2 = y2.^0.9;
figure;
subplot(1,2,1)
plot(x1,y1);
ylabel(‘Depth (m)’);
xlabel(‘Length’);
subplot(1,2,2);
plot(x2,y2,’r’);
ylabel(‘Depth (m)’);
xlabel(‘Power’);
Please find attached the data, or please access the code above to generate the data.
ThanksHello there,
I have two sets of parameter, x1 and x2 and they both vary with depth. Since the scale span of x1 is different to that of x2, what I want to do is to put the axis of x2 above, as the secondary plot (see fig below). Anyone can help me to fix this?
x1 = 0:0.1:5;
y1 = 0:1:50;
y2 = 0:1:90;
x2 = y2.^0.9;
figure;
subplot(1,2,1)
plot(x1,y1);
ylabel(‘Depth (m)’);
xlabel(‘Length’);
subplot(1,2,2);
plot(x2,y2,’r’);
ylabel(‘Depth (m)’);
xlabel(‘Power’);
Please find attached the data, or please access the code above to generate the data.
Thanks Hello there,
I have two sets of parameter, x1 and x2 and they both vary with depth. Since the scale span of x1 is different to that of x2, what I want to do is to put the axis of x2 above, as the secondary plot (see fig below). Anyone can help me to fix this?
x1 = 0:0.1:5;
y1 = 0:1:50;
y2 = 0:1:90;
x2 = y2.^0.9;
figure;
subplot(1,2,1)
plot(x1,y1);
ylabel(‘Depth (m)’);
xlabel(‘Length’);
subplot(1,2,2);
plot(x2,y2,’r’);
ylabel(‘Depth (m)’);
xlabel(‘Power’);
Please find attached the data, or please access the code above to generate the data.
Thanks overlay plot, two axis MATLAB Answers — New Questions
Why do I get the warning: “Error updating Axes. DataSpace or ColorSpace conversion method failed.” ?
X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
When I’m using yyaxis, I want the coordinates on both sides to show different units of the same set of data, but I run into the above warning. Minimum working example is given.X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
When I’m using yyaxis, I want the coordinates on both sides to show different units of the same set of data, but I run into the above warning. Minimum working example is given. X = logspace(-4,1,2e3);
Y = abs(randn(length(X),1))*1e2;
figure
yyaxis left
loglog(X,Y);
ylim([1e-3,1e3])
yyaxis right
loglog(X,Y*1e-5);
ylim([1e-3*1e-5,1e3*1e-5])
When I’m using yyaxis, I want the coordinates on both sides to show different units of the same set of data, but I run into the above warning. Minimum working example is given. updating axes,, dataspace or colorspace conversion MATLAB Answers — New Questions
Weird Imhist beahviour seen
Hi, ive been tearing my hair out all morning. I want to plot the histogram of an image. I normally use im hist. My images are 3 12 bit images that are summed, hence the max value can be 3*4095=12285. It appears my histogram is defaulting to 16 bit values.
This is my code:
IM = imread(file);
IM1=double(IM);
[maxval,idx]=max(IM1(:)) % determine number of bins (of width = unity)
maxval= double(maxval);
[counts,x] = imhist(IM,maxval);
figure
stem(x,counts,’b’, ‘.’);
counts(maxval) %check the max intensity
First of all, counts(maxval) returns zero, and here is the histogram stem plot – defaulting to 65535 levels. I want to have 1-12285 levels.
<</matlabcentral/answers/uploaded_files/21461/img21.png>>Hi, ive been tearing my hair out all morning. I want to plot the histogram of an image. I normally use im hist. My images are 3 12 bit images that are summed, hence the max value can be 3*4095=12285. It appears my histogram is defaulting to 16 bit values.
This is my code:
IM = imread(file);
IM1=double(IM);
[maxval,idx]=max(IM1(:)) % determine number of bins (of width = unity)
maxval= double(maxval);
[counts,x] = imhist(IM,maxval);
figure
stem(x,counts,’b’, ‘.’);
counts(maxval) %check the max intensity
First of all, counts(maxval) returns zero, and here is the histogram stem plot – defaulting to 65535 levels. I want to have 1-12285 levels.
<</matlabcentral/answers/uploaded_files/21461/img21.png>> Hi, ive been tearing my hair out all morning. I want to plot the histogram of an image. I normally use im hist. My images are 3 12 bit images that are summed, hence the max value can be 3*4095=12285. It appears my histogram is defaulting to 16 bit values.
This is my code:
IM = imread(file);
IM1=double(IM);
[maxval,idx]=max(IM1(:)) % determine number of bins (of width = unity)
maxval= double(maxval);
[counts,x] = imhist(IM,maxval);
figure
stem(x,counts,’b’, ‘.’);
counts(maxval) %check the max intensity
First of all, counts(maxval) returns zero, and here is the histogram stem plot – defaulting to 65535 levels. I want to have 1-12285 levels.
<</matlabcentral/answers/uploaded_files/21461/img21.png>> imhist MATLAB Answers — New Questions
Calibrate camera to IMU
Hi all,
I would like to calculate the Extrinsic transformation matrix (rotation and translation) between camera and IMU that I have on the same board. The matrix should be 4×4 dimensions (please see image attached).
I saw that is common to use Kalibr software to this but I would like to implement this in Matlab.
Can anyone help me with this issue? Is there a code that does something like this?
Thanks,
ItaiHi all,
I would like to calculate the Extrinsic transformation matrix (rotation and translation) between camera and IMU that I have on the same board. The matrix should be 4×4 dimensions (please see image attached).
I saw that is common to use Kalibr software to this but I would like to implement this in Matlab.
Can anyone help me with this issue? Is there a code that does something like this?
Thanks,
Itai Hi all,
I would like to calculate the Extrinsic transformation matrix (rotation and translation) between camera and IMU that I have on the same board. The matrix should be 4×4 dimensions (please see image attached).
I saw that is common to use Kalibr software to this but I would like to implement this in Matlab.
Can anyone help me with this issue? Is there a code that does something like this?
Thanks,
Itai camera to imu MATLAB Answers — New Questions
help using bsxfun to multiplay different size matrixes
I want to make the following:
create a matrix that has one more diamention the the matrix norm_mode (actuatty is to make a norm_mode a time function)
to accelrate it on matlab I tryied the use of bsxfun, but I get the error : "Non-singleton dimensions of the two input arrays must match each other."
Please help me fix it, I cant tell where the problem is.
tmp = zeros(newSize, newSize, length(others.t));
for idx_t = 1:length(t)
tmp(:,:,idx_t) = norm_mode(:,:) .* fields(idx_t,3) ;
end
tmp = bsxfun(@times, norm_mode, fields(:, ii));I want to make the following:
create a matrix that has one more diamention the the matrix norm_mode (actuatty is to make a norm_mode a time function)
to accelrate it on matlab I tryied the use of bsxfun, but I get the error : "Non-singleton dimensions of the two input arrays must match each other."
Please help me fix it, I cant tell where the problem is.
tmp = zeros(newSize, newSize, length(others.t));
for idx_t = 1:length(t)
tmp(:,:,idx_t) = norm_mode(:,:) .* fields(idx_t,3) ;
end
tmp = bsxfun(@times, norm_mode, fields(:, ii)); I want to make the following:
create a matrix that has one more diamention the the matrix norm_mode (actuatty is to make a norm_mode a time function)
to accelrate it on matlab I tryied the use of bsxfun, but I get the error : "Non-singleton dimensions of the two input arrays must match each other."
Please help me fix it, I cant tell where the problem is.
tmp = zeros(newSize, newSize, length(others.t));
for idx_t = 1:length(t)
tmp(:,:,idx_t) = norm_mode(:,:) .* fields(idx_t,3) ;
end
tmp = bsxfun(@times, norm_mode, fields(:, ii)); bsxfun, matlab MATLAB Answers — New Questions
Is my DDPG agent learning?
Hello everyone,
Can I conclude that my agent is learning? (maximum reward per episode is 20).
In the first image, the reward was low (-5) for the first episode, and it can be observed that the average reward starts to increase from episode 80. However, it fluctuates between 5 and 20 after episode 100. Reading other questions, it was mentioned that Q0 could help determine if the agent is learning, and as it approaches the maximum reward, I think it could be determined that it is learning. However, what makes me doubt the learning are the fluctuations in rewards after episode 100.
Another thing that makes me doubt if the agent is learning is that, while conducting another training session (image 2), the fluctuations in the average rewards are more noticeable. Even though Q0 still tends towards the maximum reward (20), in both training sessions, they continue to receive negative rewards (more than expected).
So it’s difficult for me to determine if the agent is learning. If that’s not the case, what should I modify? The reward? The agent’s hyperparameters?
I would greatly appreciate your guidance.Hello everyone,
Can I conclude that my agent is learning? (maximum reward per episode is 20).
In the first image, the reward was low (-5) for the first episode, and it can be observed that the average reward starts to increase from episode 80. However, it fluctuates between 5 and 20 after episode 100. Reading other questions, it was mentioned that Q0 could help determine if the agent is learning, and as it approaches the maximum reward, I think it could be determined that it is learning. However, what makes me doubt the learning are the fluctuations in rewards after episode 100.
Another thing that makes me doubt if the agent is learning is that, while conducting another training session (image 2), the fluctuations in the average rewards are more noticeable. Even though Q0 still tends towards the maximum reward (20), in both training sessions, they continue to receive negative rewards (more than expected).
So it’s difficult for me to determine if the agent is learning. If that’s not the case, what should I modify? The reward? The agent’s hyperparameters?
I would greatly appreciate your guidance. Hello everyone,
Can I conclude that my agent is learning? (maximum reward per episode is 20).
In the first image, the reward was low (-5) for the first episode, and it can be observed that the average reward starts to increase from episode 80. However, it fluctuates between 5 and 20 after episode 100. Reading other questions, it was mentioned that Q0 could help determine if the agent is learning, and as it approaches the maximum reward, I think it could be determined that it is learning. However, what makes me doubt the learning are the fluctuations in rewards after episode 100.
Another thing that makes me doubt if the agent is learning is that, while conducting another training session (image 2), the fluctuations in the average rewards are more noticeable. Even though Q0 still tends towards the maximum reward (20), in both training sessions, they continue to receive negative rewards (more than expected).
So it’s difficult for me to determine if the agent is learning. If that’s not the case, what should I modify? The reward? The agent’s hyperparameters?
I would greatly appreciate your guidance. reinforcement learning, ddpg agent MATLAB Answers — New Questions
Problem with Imhist method
I have an image Zoom:
Zoom =
326 313 269 237 255 329
332 271 304 256 332 302
330 320 265 215 274 316
233 219 218 224 221 224
260 224 203 226 193 210
272 231 219 227 205 227
when I perform
figure
imhist(Zoom)
the histogram is defaulting in the x-axis to x10^4
<</matlabcentral/answers/uploaded_files/19890/img11.png>>
So the histogram is just a spike.
why does it not autorange the x-axis, and how too?
thanks
JasonI have an image Zoom:
Zoom =
326 313 269 237 255 329
332 271 304 256 332 302
330 320 265 215 274 316
233 219 218 224 221 224
260 224 203 226 193 210
272 231 219 227 205 227
when I perform
figure
imhist(Zoom)
the histogram is defaulting in the x-axis to x10^4
<</matlabcentral/answers/uploaded_files/19890/img11.png>>
So the histogram is just a spike.
why does it not autorange the x-axis, and how too?
thanks
Jason I have an image Zoom:
Zoom =
326 313 269 237 255 329
332 271 304 256 332 302
330 320 265 215 274 316
233 219 218 224 221 224
260 224 203 226 193 210
272 231 219 227 205 227
when I perform
figure
imhist(Zoom)
the histogram is defaulting in the x-axis to x10^4
<</matlabcentral/answers/uploaded_files/19890/img11.png>>
So the histogram is just a spike.
why does it not autorange the x-axis, and how too?
thanks
Jason imhist MATLAB Answers — New Questions
How can I add ‘MISRA C:2023’ to Code Generation Objectives?
How can I add ‘MISRA C:2023’ to Code Generation Objectives?How can I add ‘MISRA C:2023’ to Code Generation Objectives? How can I add ‘MISRA C:2023’ to Code Generation Objectives? misra c:2023, code generation MATLAB Answers — New Questions
Download the entire product offline
How can I download Matlab R2015a so that I don’t need internet connection while installing on any other machine?How can I download Matlab R2015a so that I don’t need internet connection while installing on any other machine? How can I download Matlab R2015a so that I don’t need internet connection while installing on any other machine? offline, download MATLAB Answers — New Questions