Tag Archives: matlab
GPU Training RL Toolbox on R2022a
Hello everyone,
I am trying to train my agent with using Reinforcement Learning Toolbox Matlab2022a. Unfortunately, I couldn’t run the training due to some packages were updated. rlRepresentationOptions was contain ‘UseDevice’,’gpu’ option, but the package has been changed to rlOptimizerOptions without any ‘UseDevice’ option. How can I run my training with using gpu? Thank you in advance.Hello everyone,
I am trying to train my agent with using Reinforcement Learning Toolbox Matlab2022a. Unfortunately, I couldn’t run the training due to some packages were updated. rlRepresentationOptions was contain ‘UseDevice’,’gpu’ option, but the package has been changed to rlOptimizerOptions without any ‘UseDevice’ option. How can I run my training with using gpu? Thank you in advance. Hello everyone,
I am trying to train my agent with using Reinforcement Learning Toolbox Matlab2022a. Unfortunately, I couldn’t run the training due to some packages were updated. rlRepresentationOptions was contain ‘UseDevice’,’gpu’ option, but the package has been changed to rlOptimizerOptions without any ‘UseDevice’ option. How can I run my training with using gpu? Thank you in advance. reinforcement learning, training, machine learning MATLAB Answers — New Questions
How to loop through cell array and apply script to each double?
Hi,
I have a cell array of cell arrays of doubles called "C_512_numeric". I have the script called edit and I want to loop through all columns in the doubles in C_512_numeric and use the column data as input for edit (first argument). I have attached the script.
How would I write this code?Hi,
I have a cell array of cell arrays of doubles called "C_512_numeric". I have the script called edit and I want to loop through all columns in the doubles in C_512_numeric and use the column data as input for edit (first argument). I have attached the script.
How would I write this code? Hi,
I have a cell array of cell arrays of doubles called "C_512_numeric". I have the script called edit and I want to loop through all columns in the doubles in C_512_numeric and use the column data as input for edit (first argument). I have attached the script.
How would I write this code? cells, doubles, script, input MATLAB Answers — New Questions
how to reduce blob analysis rate in video so that object counting can happen every 3 seconds
I would like to do object counting but my code is checking for region of intereste every 1/30 second due to 30 frames per second because of this everytime it is detecting the object, any way i can solve this problem?
clc;
%% Setup of video
vidReader=vision.VideoFileReader(‘hvsstop2.mp4’);
vidReader.VideoOutputDataType=’double’;
mywriter=VideoWriter(‘mymovie.mp4’);
open(mywriter);
%% structural element
diskelem=strel(‘disk’,2);
hblob=vision.BlobAnalysis(‘MinimumBlobArea’,1500,’MaximumBlobArea’,4000);
vidPlayer = vision.DeployableVideoPlayer;
while ~isDone(vidReader)
%read frame
vidframe=step(vidReader);
%rgb to hsv color space
I=rgb2hsv(vidframe);
%htextins=insertText(I,’position’,[20,20],’Color’,[255 255 0],’Fontsize’,30);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.615;
channel1Max = 0.962;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 0.058;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.723;
channel3Max = 1.000;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & …
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & …
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
%using morphological operations
ibwopen=imopen(BW,diskelem);
%extract the blobs from the frame
[areaOut,centroidOut, bboxOut]=step(hblob,ibwopen);
%draw a box around detected objects
%ishape=insertShape(vidframe,’Rectangle’,bboxOut,’ShapeColor’,’black’);
%iannotate = insertObjectAnnotation(vidframe,"rectangle",bboxOut,’cardboard’,TextBoxOpacity=0.9,FontSize=18);
iannotate_vid = insertObjectAnnotation(vidframe,"rectangle",…
bboxOut,’versatilis’,TextBoxOpacity=0.9,FontSize=30);
%paly in video player
vidPlayer(iannotate_vid);
writeVideo(mywriter,iannotate_vid);
end
%%release
release(vidReader)
release(hblob)
release(vidPlayer)
close(mywriter)
%release(ishape)I would like to do object counting but my code is checking for region of intereste every 1/30 second due to 30 frames per second because of this everytime it is detecting the object, any way i can solve this problem?
clc;
%% Setup of video
vidReader=vision.VideoFileReader(‘hvsstop2.mp4’);
vidReader.VideoOutputDataType=’double’;
mywriter=VideoWriter(‘mymovie.mp4’);
open(mywriter);
%% structural element
diskelem=strel(‘disk’,2);
hblob=vision.BlobAnalysis(‘MinimumBlobArea’,1500,’MaximumBlobArea’,4000);
vidPlayer = vision.DeployableVideoPlayer;
while ~isDone(vidReader)
%read frame
vidframe=step(vidReader);
%rgb to hsv color space
I=rgb2hsv(vidframe);
%htextins=insertText(I,’position’,[20,20],’Color’,[255 255 0],’Fontsize’,30);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.615;
channel1Max = 0.962;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 0.058;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.723;
channel3Max = 1.000;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & …
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & …
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
%using morphological operations
ibwopen=imopen(BW,diskelem);
%extract the blobs from the frame
[areaOut,centroidOut, bboxOut]=step(hblob,ibwopen);
%draw a box around detected objects
%ishape=insertShape(vidframe,’Rectangle’,bboxOut,’ShapeColor’,’black’);
%iannotate = insertObjectAnnotation(vidframe,"rectangle",bboxOut,’cardboard’,TextBoxOpacity=0.9,FontSize=18);
iannotate_vid = insertObjectAnnotation(vidframe,"rectangle",…
bboxOut,’versatilis’,TextBoxOpacity=0.9,FontSize=30);
%paly in video player
vidPlayer(iannotate_vid);
writeVideo(mywriter,iannotate_vid);
end
%%release
release(vidReader)
release(hblob)
release(vidPlayer)
close(mywriter)
%release(ishape) I would like to do object counting but my code is checking for region of intereste every 1/30 second due to 30 frames per second because of this everytime it is detecting the object, any way i can solve this problem?
clc;
%% Setup of video
vidReader=vision.VideoFileReader(‘hvsstop2.mp4’);
vidReader.VideoOutputDataType=’double’;
mywriter=VideoWriter(‘mymovie.mp4’);
open(mywriter);
%% structural element
diskelem=strel(‘disk’,2);
hblob=vision.BlobAnalysis(‘MinimumBlobArea’,1500,’MaximumBlobArea’,4000);
vidPlayer = vision.DeployableVideoPlayer;
while ~isDone(vidReader)
%read frame
vidframe=step(vidReader);
%rgb to hsv color space
I=rgb2hsv(vidframe);
%htextins=insertText(I,’position’,[20,20],’Color’,[255 255 0],’Fontsize’,30);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.615;
channel1Max = 0.962;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 0.058;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.723;
channel3Max = 1.000;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & …
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & …
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
%using morphological operations
ibwopen=imopen(BW,diskelem);
%extract the blobs from the frame
[areaOut,centroidOut, bboxOut]=step(hblob,ibwopen);
%draw a box around detected objects
%ishape=insertShape(vidframe,’Rectangle’,bboxOut,’ShapeColor’,’black’);
%iannotate = insertObjectAnnotation(vidframe,"rectangle",bboxOut,’cardboard’,TextBoxOpacity=0.9,FontSize=18);
iannotate_vid = insertObjectAnnotation(vidframe,"rectangle",…
bboxOut,’versatilis’,TextBoxOpacity=0.9,FontSize=30);
%paly in video player
vidPlayer(iannotate_vid);
writeVideo(mywriter,iannotate_vid);
end
%%release
release(vidReader)
release(hblob)
release(vidPlayer)
close(mywriter)
%release(ishape) computer vision, blob MATLAB Answers — New Questions
How to convert tables into numeric arrays?
Hi I have the data set C_512 (see attached) and I want to make the tables within the cells of the cell array into numeric arrays so that there are no longer any tables in C_512. I used this code below:
% Load the .mat file
load(‘/path/to/C_512.mat’);
% Initialize a new cell array to store numeric arrays
C_512_numeric = cell(size(C_512));
% Loop through each cell and convert its content to numeric arrays
for i = 1:size(C_512, 1)
for j = 1:size(C_512, 2)
T = C_512{i, j};
if istable(T)
C_512_numeric{i, j} = table2array(T);
else
C_512_numeric{i, j} = T; % If it’s already an array or matrix
end
end
end
% Save the numeric data to a new .mat file
save(‘C_512_numeric.mat’, ‘C_512_numeric’);
Unfortunately, C_512_numeric still contains tables. Why is that?Hi I have the data set C_512 (see attached) and I want to make the tables within the cells of the cell array into numeric arrays so that there are no longer any tables in C_512. I used this code below:
% Load the .mat file
load(‘/path/to/C_512.mat’);
% Initialize a new cell array to store numeric arrays
C_512_numeric = cell(size(C_512));
% Loop through each cell and convert its content to numeric arrays
for i = 1:size(C_512, 1)
for j = 1:size(C_512, 2)
T = C_512{i, j};
if istable(T)
C_512_numeric{i, j} = table2array(T);
else
C_512_numeric{i, j} = T; % If it’s already an array or matrix
end
end
end
% Save the numeric data to a new .mat file
save(‘C_512_numeric.mat’, ‘C_512_numeric’);
Unfortunately, C_512_numeric still contains tables. Why is that? Hi I have the data set C_512 (see attached) and I want to make the tables within the cells of the cell array into numeric arrays so that there are no longer any tables in C_512. I used this code below:
% Load the .mat file
load(‘/path/to/C_512.mat’);
% Initialize a new cell array to store numeric arrays
C_512_numeric = cell(size(C_512));
% Loop through each cell and convert its content to numeric arrays
for i = 1:size(C_512, 1)
for j = 1:size(C_512, 2)
T = C_512{i, j};
if istable(T)
C_512_numeric{i, j} = table2array(T);
else
C_512_numeric{i, j} = T; % If it’s already an array or matrix
end
end
end
% Save the numeric data to a new .mat file
save(‘C_512_numeric.mat’, ‘C_512_numeric’);
Unfortunately, C_512_numeric still contains tables. Why is that? convert, tables, numeric array, error, cell MATLAB Answers — New Questions
Simscape version change cause problem
Hi all, we created a simscape model in MATLAB 2021a which perfectly works. When I open it in MATLAB 2024a or in MATLAB online, I receive many errors. One of the error is
"Cannot find library called ‘sm_cable_robot_lib’. "
and
"Pulley-End Alignment1′ cannot be found on MATLAB path or has an invalid path."
I search for sm_cable_robot_lib but no result. Is there any change in simscape in MATLAB 2024?Hi all, we created a simscape model in MATLAB 2021a which perfectly works. When I open it in MATLAB 2024a or in MATLAB online, I receive many errors. One of the error is
"Cannot find library called ‘sm_cable_robot_lib’. "
and
"Pulley-End Alignment1′ cannot be found on MATLAB path or has an invalid path."
I search for sm_cable_robot_lib but no result. Is there any change in simscape in MATLAB 2024? Hi all, we created a simscape model in MATLAB 2021a which perfectly works. When I open it in MATLAB 2024a or in MATLAB online, I receive many errors. One of the error is
"Cannot find library called ‘sm_cable_robot_lib’. "
and
"Pulley-End Alignment1′ cannot be found on MATLAB path or has an invalid path."
I search for sm_cable_robot_lib but no result. Is there any change in simscape in MATLAB 2024? simscape, cable-robot, pulley MATLAB Answers — New Questions
Datetime format capatilization sensitivity inconsistent?
So I was trying to add milliseconds to my datetime variables and found a sort of inconsistency?
When setting datetime format using datetime(‘now’,’Format’,’hh:mm:ss.sss’) , the sss at the end is not capatilization sensitive; but when trying to access and change it using variable_name.Format = ‘hh:mm:ss.SSS’, the SSS at the end is capatilization sensitive.
Is this a minor inconsitency or is this intended? If it’s the latter what is the rationale behind? As it only makes it more confusing imoSo I was trying to add milliseconds to my datetime variables and found a sort of inconsistency?
When setting datetime format using datetime(‘now’,’Format’,’hh:mm:ss.sss’) , the sss at the end is not capatilization sensitive; but when trying to access and change it using variable_name.Format = ‘hh:mm:ss.SSS’, the SSS at the end is capatilization sensitive.
Is this a minor inconsitency or is this intended? If it’s the latter what is the rationale behind? As it only makes it more confusing imo So I was trying to add milliseconds to my datetime variables and found a sort of inconsistency?
When setting datetime format using datetime(‘now’,’Format’,’hh:mm:ss.sss’) , the sss at the end is not capatilization sensitive; but when trying to access and change it using variable_name.Format = ‘hh:mm:ss.SSS’, the SSS at the end is capatilization sensitive.
Is this a minor inconsitency or is this intended? If it’s the latter what is the rationale behind? As it only makes it more confusing imo datetime MATLAB Answers — New Questions
How do you access the datatype of Bus Element Ports in MATLAB
I have a model that outputs a Bus of type ‘TestBus’. The Bus is comprised of three Doubles, which I define and output using ‘Bus Element Outports’.
I would like to access the output datatype of my entire model (which is a ‘TestBus’). However, when I access the datatype of the Bus Element Outports, I receive ‘Double’ instead of ‘TestBus’.
For instance, the following code returns ‘Double’ on my compiled model:
get(<Bus Element Handle>,’CompiledPortDataTypes’).Inport{1}; % Returns Double, should return TestBus
How can I access the Bus output datatype of my Bus Element Ports?I have a model that outputs a Bus of type ‘TestBus’. The Bus is comprised of three Doubles, which I define and output using ‘Bus Element Outports’.
I would like to access the output datatype of my entire model (which is a ‘TestBus’). However, when I access the datatype of the Bus Element Outports, I receive ‘Double’ instead of ‘TestBus’.
For instance, the following code returns ‘Double’ on my compiled model:
get(<Bus Element Handle>,’CompiledPortDataTypes’).Inport{1}; % Returns Double, should return TestBus
How can I access the Bus output datatype of my Bus Element Ports? I have a model that outputs a Bus of type ‘TestBus’. The Bus is comprised of three Doubles, which I define and output using ‘Bus Element Outports’.
I would like to access the output datatype of my entire model (which is a ‘TestBus’). However, when I access the datatype of the Bus Element Outports, I receive ‘Double’ instead of ‘TestBus’.
For instance, the following code returns ‘Double’ on my compiled model:
get(<Bus Element Handle>,’CompiledPortDataTypes’).Inport{1}; % Returns Double, should return TestBus
How can I access the Bus output datatype of my Bus Element Ports? buselement, ports, compiledportdatatypes, outdatatypestr MATLAB Answers — New Questions
How to calculate Coherence Bandwidth from transfer Function H(f)?
Hello,
I have measurement data S21, of many different channels. How can I calculate the coherence Bandwidth of the channels from that?
Thanks a lot for your valuable helpHello,
I have measurement data S21, of many different channels. How can I calculate the coherence Bandwidth of the channels from that?
Thanks a lot for your valuable help Hello,
I have measurement data S21, of many different channels. How can I calculate the coherence Bandwidth of the channels from that?
Thanks a lot for your valuable help communication, digital signal processing MATLAB Answers — New Questions
UIfigure value changes on a while loop
לק"י
Hello!
I have a time series stack of cell masks of 21 timepoints. each mask has a unique gray scale value of its own.
I need to acquire a single pixel grayscale vlaue by clicking on the desired cell mask.
My strategy is to have two figures open at the same time.
The first figure will present the image of a single time sequence and after a pixel will be chosen it’s grayscale value will be saved.
The second figure will present a loop of the time series to allow me for easy identification of the desired cell. I will only see it no interactions made with this loop figure.
This figure is running with a while loop, that will end only when I click and UIfigure (b) of a button, so the condition is when b.Value==0.
When I run the code, I awkwardly get an error when enetring the third while loop.
The code:
filename=’17.07.2024 aHER2 carrier W.T cd45low+cd4+lstrckr001 cellpose stack.tif’;
info = imfinfo(filename);
numberOfImages = length(info);
j=1;
for i= 1:numberOfImages
crntimg=imread(filename, i);
figure (1)
imshow (crntimg,[]);
impixelinfo
fig = uifigure;
b = uibutton(fig,"state", "Text","Press to end", "IconAlignment","top", …
"Position",[100 100 50 50]);
while b.Value == 0
k=1
crntimgloop=imread(filename, j);
imshow (crntimgloop,[]);
if j<21
j=j+1;
else
j=1;
end
j
end
end
The error output:
j =
3
Invalid or deleted object.
Error in matlab.ui.control.internal.model.AbstractBinaryComponent/get.Value (line 95)
value = obj.PrivateValue;
Error in Cell_mask_identification_over_time (line 13)
while b.Value == 0
I tried to upload the mask’s time series file, but it was too large.
Thanks,
Amit.לק"י
Hello!
I have a time series stack of cell masks of 21 timepoints. each mask has a unique gray scale value of its own.
I need to acquire a single pixel grayscale vlaue by clicking on the desired cell mask.
My strategy is to have two figures open at the same time.
The first figure will present the image of a single time sequence and after a pixel will be chosen it’s grayscale value will be saved.
The second figure will present a loop of the time series to allow me for easy identification of the desired cell. I will only see it no interactions made with this loop figure.
This figure is running with a while loop, that will end only when I click and UIfigure (b) of a button, so the condition is when b.Value==0.
When I run the code, I awkwardly get an error when enetring the third while loop.
The code:
filename=’17.07.2024 aHER2 carrier W.T cd45low+cd4+lstrckr001 cellpose stack.tif’;
info = imfinfo(filename);
numberOfImages = length(info);
j=1;
for i= 1:numberOfImages
crntimg=imread(filename, i);
figure (1)
imshow (crntimg,[]);
impixelinfo
fig = uifigure;
b = uibutton(fig,"state", "Text","Press to end", "IconAlignment","top", …
"Position",[100 100 50 50]);
while b.Value == 0
k=1
crntimgloop=imread(filename, j);
imshow (crntimgloop,[]);
if j<21
j=j+1;
else
j=1;
end
j
end
end
The error output:
j =
3
Invalid or deleted object.
Error in matlab.ui.control.internal.model.AbstractBinaryComponent/get.Value (line 95)
value = obj.PrivateValue;
Error in Cell_mask_identification_over_time (line 13)
while b.Value == 0
I tried to upload the mask’s time series file, but it was too large.
Thanks,
Amit. לק"י
Hello!
I have a time series stack of cell masks of 21 timepoints. each mask has a unique gray scale value of its own.
I need to acquire a single pixel grayscale vlaue by clicking on the desired cell mask.
My strategy is to have two figures open at the same time.
The first figure will present the image of a single time sequence and after a pixel will be chosen it’s grayscale value will be saved.
The second figure will present a loop of the time series to allow me for easy identification of the desired cell. I will only see it no interactions made with this loop figure.
This figure is running with a while loop, that will end only when I click and UIfigure (b) of a button, so the condition is when b.Value==0.
When I run the code, I awkwardly get an error when enetring the third while loop.
The code:
filename=’17.07.2024 aHER2 carrier W.T cd45low+cd4+lstrckr001 cellpose stack.tif’;
info = imfinfo(filename);
numberOfImages = length(info);
j=1;
for i= 1:numberOfImages
crntimg=imread(filename, i);
figure (1)
imshow (crntimg,[]);
impixelinfo
fig = uifigure;
b = uibutton(fig,"state", "Text","Press to end", "IconAlignment","top", …
"Position",[100 100 50 50]);
while b.Value == 0
k=1
crntimgloop=imread(filename, j);
imshow (crntimgloop,[]);
if j<21
j=j+1;
else
j=1;
end
j
end
end
The error output:
j =
3
Invalid or deleted object.
Error in matlab.ui.control.internal.model.AbstractBinaryComponent/get.Value (line 95)
value = obj.PrivateValue;
Error in Cell_mask_identification_over_time (line 13)
while b.Value == 0
I tried to upload the mask’s time series file, but it was too large.
Thanks,
Amit. uifigure, loops, while loop MATLAB Answers — New Questions
Need help with homework.
This is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
endThis is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
end This is only my first couple of days using MATLAB. Basically I am trying to make a little temperature conversion program however the displayed answer is always in the form of a 1 x 2 matrix. Any advice is appreciated.
% prompt for user to choose which conversion
chosen_temp = input(‘What is ur chosen conversion, Celsius to Farenheit (1) or Farenheit to Celsius (2): ‘,’s’);
% using that answer to determine which formula is needed and then the
% converted answer
switch chosen_temp
case ‘1’
disp(‘Celsius to Farenheit’)
initial_temp = input(‘Enter the temperature you would like to convert in Celsius:’, ‘s’);
temperature = initial_temp * 9 / 5 + 32
case ‘2’
disp(‘Farenheit to Celsius’)
initial_temp = input(‘Enter the temperature you would like to convert in Farenheit:’, ‘s’);
temperature = (initial_temp – 32) * (5 / 9)
end transferred MATLAB Answers — New Questions
Is there a Matlab command to check the expiration date of my license?
I’d like to follow the expiration date of my Matlab license from within Matlab. Is there a Matlab command to check the expiration date of my license?I’d like to follow the expiration date of my Matlab license from within Matlab. Is there a Matlab command to check the expiration date of my license? I’d like to follow the expiration date of my Matlab license from within Matlab. Is there a Matlab command to check the expiration date of my license? license, license expiration MATLAB Answers — New Questions
Classification for seperate training and testing dataset
Hello gyus,
I extract 20 features for 8 images(which are 8 diseases) and then I made a .csv file of these features.I have also an another .csv file
with these features from a dataset of 3000 images. So I have the trining and the testing dataset. I want to classificate the 3000 images
with the 8 diseases from the the first .csv file. Can i use the tool of classification learner or only writing code?
Thanks in advance!Hello gyus,
I extract 20 features for 8 images(which are 8 diseases) and then I made a .csv file of these features.I have also an another .csv file
with these features from a dataset of 3000 images. So I have the trining and the testing dataset. I want to classificate the 3000 images
with the 8 diseases from the the first .csv file. Can i use the tool of classification learner or only writing code?
Thanks in advance! Hello gyus,
I extract 20 features for 8 images(which are 8 diseases) and then I made a .csv file of these features.I have also an another .csv file
with these features from a dataset of 3000 images. So I have the trining and the testing dataset. I want to classificate the 3000 images
with the 8 diseases from the the first .csv file. Can i use the tool of classification learner or only writing code?
Thanks in advance! classificationseperate dataclassification tooltesting datatraining datafeauturescsv file MATLAB Answers — New Questions
how to ensemble 5 different deep learning model with majority voting?
here i saw ensemble deep learning models and they get better results in ensemble learning
https://blogs.mathworks.com/deep-learning/2019/06/03/ensemble-learning/
now i try 5 different deep learning system (for example: resnet, darknet, xception, alexnet, sequeezneet) for my image dataset (for example tumor detection healthy show "0" tumour shows"1" in dataset. i get accuracyresults for these networks but i coudn’t find prediction matrix. so my aim is applying majority voting on these 5 deep learning networks and improve my results?
do you have any suggestions?here i saw ensemble deep learning models and they get better results in ensemble learning
https://blogs.mathworks.com/deep-learning/2019/06/03/ensemble-learning/
now i try 5 different deep learning system (for example: resnet, darknet, xception, alexnet, sequeezneet) for my image dataset (for example tumor detection healthy show "0" tumour shows"1" in dataset. i get accuracyresults for these networks but i coudn’t find prediction matrix. so my aim is applying majority voting on these 5 deep learning networks and improve my results?
do you have any suggestions? here i saw ensemble deep learning models and they get better results in ensemble learning
https://blogs.mathworks.com/deep-learning/2019/06/03/ensemble-learning/
now i try 5 different deep learning system (for example: resnet, darknet, xception, alexnet, sequeezneet) for my image dataset (for example tumor detection healthy show "0" tumour shows"1" in dataset. i get accuracyresults for these networks but i coudn’t find prediction matrix. so my aim is applying majority voting on these 5 deep learning networks and improve my results?
do you have any suggestions? ensemble, deep learning MATLAB Answers — New Questions
Logistic Growth Model – Code and Plot
I need to plot a differential equation that shows logistic growth. The equation is: P=(K*A*e^r*t)/(1+A*e^r*t)
where K is the carrying capacity, a constant, and K = 1,704,885 and A = 0.0122.
I need the correct code so that I can solve for r, as well as put different t to find the population at varying times.
I also need to plot the solution. Thank you for any help!I need to plot a differential equation that shows logistic growth. The equation is: P=(K*A*e^r*t)/(1+A*e^r*t)
where K is the carrying capacity, a constant, and K = 1,704,885 and A = 0.0122.
I need the correct code so that I can solve for r, as well as put different t to find the population at varying times.
I also need to plot the solution. Thank you for any help! I need to plot a differential equation that shows logistic growth. The equation is: P=(K*A*e^r*t)/(1+A*e^r*t)
where K is the carrying capacity, a constant, and K = 1,704,885 and A = 0.0122.
I need the correct code so that I can solve for r, as well as put different t to find the population at varying times.
I also need to plot the solution. Thank you for any help! logistic growth, carrying capacity MATLAB Answers — New Questions
MATLAB GUI does not finish execution when called from another MATLAB based GUI.
Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ?Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ? Hi Everyone,
I have a MATLAB R2020b gui based application which basically is a menu with buttons and each button press is another MATLAB GUI based executable. The problem is that when I run the main wrapper GUI and press a button, it successfuly launches the executable associated with that. The inner gui based executable is supposed to interface with HW and collect data, save and close and return back the execution to the main GUI. However the problem is that once the inner gui executable saves the data using the save function, it somehow gets frozen, hangs. Nothing happens.
Now here are some other strange observations.
When I run the same deployed setup with extended screens connected to my laptop, it works.
When I run the inner gui directly by double clicking it instead of calling it as a button press from the outer gui, it works.
If I comment out the save function inside the inner GUI, the data doesn’t get saved but the program executes and it works.
I have not been able to undestand this weird behavior. Has someone encountered this behavior before ?
Here is the code inside the launcher.exe that executes on a button press and calls another GUI (executbable)
function abc_Callback(hObject, eventdata, handles)
handles.abc.Enable = ‘off’;
pause(0.2)
try
executablePath = fullfile(handles.rootdirectory, ‘folder1’, ‘folder2’, ‘abc.exe’);
command = sprintf(‘"%s"’, executablePath);
[status] = system(execFileNameWithExt);
catch e
disp(e)
end
handles.abc.Enable = ‘on’;
Also here is where the save function is run. I added some debug lines before and after the save function and realized that
msgbox(‘calling "save" function inside generatereport’);
save(fullfile(res.Report.reportDir,reportName),’res’);
msgbox(‘executed the "save" function inside generatereport, now on line 99’);
now the 2nd msgbox never gets executed. However the save function does save the res object currently at the desired location.
How do you think I should try to debug this problem ? Should i use the logs ? r2020b, gui, guide, matlab, application MATLAB Answers — New Questions
Unable to resolve the name cv.getOptimalNewCameraMatrix.
I do not solve this problem. I am trying to solve in many ways. Please anyone help me.
I find this problem:
Unable to resolve the name cv.getOptimalNewCameraMatrix.
Error in undistortion>undistorb_images (line 92)
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0,
[width,height]);
Error in undistortion (line 1)
undistorb_images([], []);
undistorb_images([], []);
function [tvec, rvec, camera_matrix, dist] = read_wp2c(input_name)
%input_name = "output_wp2camera.json";
raw = fileread(input_name);
input_params = jsondecode(raw);
camera_matrix = input_params.camera_matrix;
dist = input_params.dist_coefs;
tvec_json = input_params.translational_vectors;
%tvec = struct2cell(tvec_json);
rvec_json = input_params.rotational_vectors;
%rvec = struct2cell(rvec_json);
tvec = [];
rvec = [];
len = length(tvec_json);
for i = 1:len
%tvec.append(array(tvec_json(image + string(i))))
%tvec.append.tvec_json(i);
tvec = struct2cell(tvec_json(i));
%[A{:}]
%tvec.append(input_params.translational_vectors.image0);
%rvec.append(array(rvec_json(image + string(i))));
rvec = struct2cell(rvec_json(i));
end
end
function undistorb_images(inputParams, result)
%if result is None:
if isempty(result)
input_name = "output_wp2camera.json";
[tvec, rvec, camera_matrix, dist] = read_wp2c(input_name);
else
tvec = result(4);
rvec = result(3);
camera_matrix = result(1);
dist = result(2);
end
if isempty(inputParams)
image_path = "images";
else
image_path = inputParams.opencv_storage.settings.Images_Folder;
end
%image_files = [];
files = [dir(fullfile(image_path,’*.jpg’)); dir(fullfile(image_path,’*.png’)); dir(fullfile(image_path,’*.jpeg’)); dir(fullfile(image_path,’*.PNG’))];
%files = dir(fullfile(image_path, ‘*.(jpg|png)’));
L = length(files);
% kk=0;
% for i=1:L
% file=files(i).name;
% image_files = [image_files, file]
%
%
% end
%disp(image_files)
% for f = dir(image_path)
% %ext = image_path(split(lower(f)));
% %disp(f)
% %if f.endsWith([".jpg",".jpeg",".png", ".PNG"])
% % image_files.append(f);
% %end
% end
image_file_name = [];
if ~isempty(files)
for i=1:L
file=files(i).name;
image_file_name = [image_file_name,file];
%disp(image_file_name)
image = imread(image_path + "" + file);
%disp(image);
% [imagePoints, boardSize] = detectCheckerboardPoints(image_file_name);
% squareSize = 29;
% worldPoints = generateCheckerboardPoints(boardSize, squareSize);
%
% I = readimage(image, 1);
% imageSize = [size(I,1), size(I,2)];
% [params, ~, estimationErrors] = estimateCameraParameters(imagePoinsts, worldPoints, ‘ImageSize’);
[height, width] = size(image);
%disp(string(height) + " " + string(width))
%[newCameraMatrix,w] = cv.getOptimalNewCameraMatrix(cameraMatrix, dist, [width,height]);
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0, [width,height]);
%dst = cv2.undistort(image, camera_matrix, dist, None, newcameramtx)
% imageFileNames{i} = fullfile(matlabroot,’toolbox’,’vision’,’visiondata’,’calibration’,’webcam’,image_file_name);
% [imagePoints,~,imagesUsed] = detectCheckerboardPoints(imageFileNames, ‘PartialDetections’, false);
% imageFileNames = imageFileNames(imagesUsed);
% for i = 1:numel(imageFileNames)
% I = imread(imageFileNames{i});
% subplot(2, 2, i);
% imshow(I);
% hold on;
% plot(imagePoints(:,1,i),imagePoints(:,2,i),’ro’);
% end
[mapx, mapy] = cv.initUndistortRectifyMap(camera_matrix, dist, None, newcameramtx, [width,height], 5);
dst = cv.remap(image, mapx, mapy, INTER_LINEAR);
x, y, w, h = roi;
dst = dst(y:y+h, x:x+w);
[height, width] = size(dst);
print(string(height) + " " + string(width));
imwrite("undistortion/" + file, dst);
end
end
endI do not solve this problem. I am trying to solve in many ways. Please anyone help me.
I find this problem:
Unable to resolve the name cv.getOptimalNewCameraMatrix.
Error in undistortion>undistorb_images (line 92)
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0,
[width,height]);
Error in undistortion (line 1)
undistorb_images([], []);
undistorb_images([], []);
function [tvec, rvec, camera_matrix, dist] = read_wp2c(input_name)
%input_name = "output_wp2camera.json";
raw = fileread(input_name);
input_params = jsondecode(raw);
camera_matrix = input_params.camera_matrix;
dist = input_params.dist_coefs;
tvec_json = input_params.translational_vectors;
%tvec = struct2cell(tvec_json);
rvec_json = input_params.rotational_vectors;
%rvec = struct2cell(rvec_json);
tvec = [];
rvec = [];
len = length(tvec_json);
for i = 1:len
%tvec.append(array(tvec_json(image + string(i))))
%tvec.append.tvec_json(i);
tvec = struct2cell(tvec_json(i));
%[A{:}]
%tvec.append(input_params.translational_vectors.image0);
%rvec.append(array(rvec_json(image + string(i))));
rvec = struct2cell(rvec_json(i));
end
end
function undistorb_images(inputParams, result)
%if result is None:
if isempty(result)
input_name = "output_wp2camera.json";
[tvec, rvec, camera_matrix, dist] = read_wp2c(input_name);
else
tvec = result(4);
rvec = result(3);
camera_matrix = result(1);
dist = result(2);
end
if isempty(inputParams)
image_path = "images";
else
image_path = inputParams.opencv_storage.settings.Images_Folder;
end
%image_files = [];
files = [dir(fullfile(image_path,’*.jpg’)); dir(fullfile(image_path,’*.png’)); dir(fullfile(image_path,’*.jpeg’)); dir(fullfile(image_path,’*.PNG’))];
%files = dir(fullfile(image_path, ‘*.(jpg|png)’));
L = length(files);
% kk=0;
% for i=1:L
% file=files(i).name;
% image_files = [image_files, file]
%
%
% end
%disp(image_files)
% for f = dir(image_path)
% %ext = image_path(split(lower(f)));
% %disp(f)
% %if f.endsWith([".jpg",".jpeg",".png", ".PNG"])
% % image_files.append(f);
% %end
% end
image_file_name = [];
if ~isempty(files)
for i=1:L
file=files(i).name;
image_file_name = [image_file_name,file];
%disp(image_file_name)
image = imread(image_path + "" + file);
%disp(image);
% [imagePoints, boardSize] = detectCheckerboardPoints(image_file_name);
% squareSize = 29;
% worldPoints = generateCheckerboardPoints(boardSize, squareSize);
%
% I = readimage(image, 1);
% imageSize = [size(I,1), size(I,2)];
% [params, ~, estimationErrors] = estimateCameraParameters(imagePoinsts, worldPoints, ‘ImageSize’);
[height, width] = size(image);
%disp(string(height) + " " + string(width))
%[newCameraMatrix,w] = cv.getOptimalNewCameraMatrix(cameraMatrix, dist, [width,height]);
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0, [width,height]);
%dst = cv2.undistort(image, camera_matrix, dist, None, newcameramtx)
% imageFileNames{i} = fullfile(matlabroot,’toolbox’,’vision’,’visiondata’,’calibration’,’webcam’,image_file_name);
% [imagePoints,~,imagesUsed] = detectCheckerboardPoints(imageFileNames, ‘PartialDetections’, false);
% imageFileNames = imageFileNames(imagesUsed);
% for i = 1:numel(imageFileNames)
% I = imread(imageFileNames{i});
% subplot(2, 2, i);
% imshow(I);
% hold on;
% plot(imagePoints(:,1,i),imagePoints(:,2,i),’ro’);
% end
[mapx, mapy] = cv.initUndistortRectifyMap(camera_matrix, dist, None, newcameramtx, [width,height], 5);
dst = cv.remap(image, mapx, mapy, INTER_LINEAR);
x, y, w, h = roi;
dst = dst(y:y+h, x:x+w);
[height, width] = size(dst);
print(string(height) + " " + string(width));
imwrite("undistortion/" + file, dst);
end
end
end I do not solve this problem. I am trying to solve in many ways. Please anyone help me.
I find this problem:
Unable to resolve the name cv.getOptimalNewCameraMatrix.
Error in undistortion>undistorb_images (line 92)
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0,
[width,height]);
Error in undistortion (line 1)
undistorb_images([], []);
undistorb_images([], []);
function [tvec, rvec, camera_matrix, dist] = read_wp2c(input_name)
%input_name = "output_wp2camera.json";
raw = fileread(input_name);
input_params = jsondecode(raw);
camera_matrix = input_params.camera_matrix;
dist = input_params.dist_coefs;
tvec_json = input_params.translational_vectors;
%tvec = struct2cell(tvec_json);
rvec_json = input_params.rotational_vectors;
%rvec = struct2cell(rvec_json);
tvec = [];
rvec = [];
len = length(tvec_json);
for i = 1:len
%tvec.append(array(tvec_json(image + string(i))))
%tvec.append.tvec_json(i);
tvec = struct2cell(tvec_json(i));
%[A{:}]
%tvec.append(input_params.translational_vectors.image0);
%rvec.append(array(rvec_json(image + string(i))));
rvec = struct2cell(rvec_json(i));
end
end
function undistorb_images(inputParams, result)
%if result is None:
if isempty(result)
input_name = "output_wp2camera.json";
[tvec, rvec, camera_matrix, dist] = read_wp2c(input_name);
else
tvec = result(4);
rvec = result(3);
camera_matrix = result(1);
dist = result(2);
end
if isempty(inputParams)
image_path = "images";
else
image_path = inputParams.opencv_storage.settings.Images_Folder;
end
%image_files = [];
files = [dir(fullfile(image_path,’*.jpg’)); dir(fullfile(image_path,’*.png’)); dir(fullfile(image_path,’*.jpeg’)); dir(fullfile(image_path,’*.PNG’))];
%files = dir(fullfile(image_path, ‘*.(jpg|png)’));
L = length(files);
% kk=0;
% for i=1:L
% file=files(i).name;
% image_files = [image_files, file]
%
%
% end
%disp(image_files)
% for f = dir(image_path)
% %ext = image_path(split(lower(f)));
% %disp(f)
% %if f.endsWith([".jpg",".jpeg",".png", ".PNG"])
% % image_files.append(f);
% %end
% end
image_file_name = [];
if ~isempty(files)
for i=1:L
file=files(i).name;
image_file_name = [image_file_name,file];
%disp(image_file_name)
image = imread(image_path + "" + file);
%disp(image);
% [imagePoints, boardSize] = detectCheckerboardPoints(image_file_name);
% squareSize = 29;
% worldPoints = generateCheckerboardPoints(boardSize, squareSize);
%
% I = readimage(image, 1);
% imageSize = [size(I,1), size(I,2)];
% [params, ~, estimationErrors] = estimateCameraParameters(imagePoinsts, worldPoints, ‘ImageSize’);
[height, width] = size(image);
%disp(string(height) + " " + string(width))
%[newCameraMatrix,w] = cv.getOptimalNewCameraMatrix(cameraMatrix, dist, [width,height]);
[newcameramtx, roi] = cv.getOptimalNewCameraMatrix(camera_matrix, dist, [width,height], 0, [width,height]);
%dst = cv2.undistort(image, camera_matrix, dist, None, newcameramtx)
% imageFileNames{i} = fullfile(matlabroot,’toolbox’,’vision’,’visiondata’,’calibration’,’webcam’,image_file_name);
% [imagePoints,~,imagesUsed] = detectCheckerboardPoints(imageFileNames, ‘PartialDetections’, false);
% imageFileNames = imageFileNames(imagesUsed);
% for i = 1:numel(imageFileNames)
% I = imread(imageFileNames{i});
% subplot(2, 2, i);
% imshow(I);
% hold on;
% plot(imagePoints(:,1,i),imagePoints(:,2,i),’ro’);
% end
[mapx, mapy] = cv.initUndistortRectifyMap(camera_matrix, dist, None, newcameramtx, [width,height], 5);
dst = cv.remap(image, mapx, mapy, INTER_LINEAR);
x, y, w, h = roi;
dst = dst(y:y+h, x:x+w);
[height, width] = size(dst);
print(string(height) + " " + string(width));
imwrite("undistortion/" + file, dst);
end
end
end image processing, matlab MATLAB Answers — New Questions
Bessel function has problems in converting symbolic function into handle function.
I want to derive the spherical Bessel function, so I first construct the spherical Bessel function by using Bessel function.
,
Because I want to derive the spherical Bessel function, I want to first construct a symbolic expression of the spherical Bessel function, and then use the diff function to get the first derivative, and then convert it into a function handle.
However, when n is large, the symbolic expression of spherical Bessel function has problems(In the figure below, I haven’t derived the spherical Bessel function yet, but there has been a case of non-convergence, so it can be seen that the derivative is also non-convergence):
If I don’t need to find the derivative of Bessel function, then I only need to use the handle to complete this task. I need to construct a function to find the first derivative of spherical Bessel function at any point. Is there any good way?I want to derive the spherical Bessel function, so I first construct the spherical Bessel function by using Bessel function.
,
Because I want to derive the spherical Bessel function, I want to first construct a symbolic expression of the spherical Bessel function, and then use the diff function to get the first derivative, and then convert it into a function handle.
However, when n is large, the symbolic expression of spherical Bessel function has problems(In the figure below, I haven’t derived the spherical Bessel function yet, but there has been a case of non-convergence, so it can be seen that the derivative is also non-convergence):
If I don’t need to find the derivative of Bessel function, then I only need to use the handle to complete this task. I need to construct a function to find the first derivative of spherical Bessel function at any point. Is there any good way? I want to derive the spherical Bessel function, so I first construct the spherical Bessel function by using Bessel function.
,
Because I want to derive the spherical Bessel function, I want to first construct a symbolic expression of the spherical Bessel function, and then use the diff function to get the first derivative, and then convert it into a function handle.
However, when n is large, the symbolic expression of spherical Bessel function has problems(In the figure below, I haven’t derived the spherical Bessel function yet, but there has been a case of non-convergence, so it can be seen that the derivative is also non-convergence):
If I don’t need to find the derivative of Bessel function, then I only need to use the handle to complete this task. I need to construct a function to find the first derivative of spherical Bessel function at any point. Is there any good way? bessel function, numerical method, restrain oneself MATLAB Answers — New Questions
Weird bugs when solving three coupled second order differential equations using ode45
Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance!Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance! Hi guys, I am new to ode45 so I am very confused about its results. I have good results when solving two coupled differential equations (say, x1 and y ), but when I add one more equation (say x2), then the results are very different and even if I set x2 equation the same as x1, which doesn’t make much sense for me. Here are the codes I used:
eq1 = diff(x1,2) == -2*gamma_ir*omega_ir1*dx1 – omega_ir1^2*x1 + y + 2*x2*y;
eq2 = diff(x2,2) == -2*gamma_ir*omega_ir2*dx2 – omega_ir2^2*x2 + y + 2*x1*y;
eq3 = diff(y,2) == -2*gamma_r*omega_r*dy – omega_r^2*y + x1*x2;
V = odeToVectorField(eq1,eq2,eq3);
M = matlabFunction(V,’vars’, {‘t’,’Y’});
interval = t0;
ySol = ode45(M,interval,y0);
tValues = linspace(interval(1),interval(2),tNum);
sol = deval(ySol,tValues,3);
Thanks in advance! differential equations, ode45 MATLAB Answers — New Questions
How to overlay box plot with distribution histogram in the same graph
I want to overlay box plot on my distribution histogram (something like as shown in the figure). How can I do that?I want to overlay box plot on my distribution histogram (something like as shown in the figure). How can I do that? I want to overlay box plot on my distribution histogram (something like as shown in the figure). How can I do that? box plot, histogram, overlay MATLAB Answers — New Questions
Having Boxplot problem with not defined double type
Hello, I am trying to plot boxplot.
x = [1 2 3 4 5];
y = [1.13465 1.17166 1.19973 1.78338 1.83673
3.96e-12 3.6e-11 0.109991 1.0131 1.57166
0.574522 0.619429 0.685391 1.21099 1.73831
1.27e-11 0.142583 0.308049 0.890379 1.38142
3.5e-12 0.0606085 0.137094 0.565742 0.915032
1.77e-11 0.0206984 0.096124 0.213596 0.548369
0.343735 0.358206 0.386193 1.04343 1.80219
0.342868 0.333045 0.341806 0.760036 1.41684
0.423389 0.412866 0.415499 0.569211 0.564488
4e-12 3.67e-11 0.109991 1.0131 1.57166
0.692851 0.696025 0.704127 1.30321 1.88094
5.5e-11 0.0395349 0.180155 0.639514 1.04088];
boxplot(x,y)
this is the code that I used,
but when I tried to plot, it said
‘The function ‘boxplot’ is not defined for inputs of type ‘double’.
Error occurred: untitled (line 22) boxplot(x,y)’
Can anyone help me to solve the problem?
Thank you!Hello, I am trying to plot boxplot.
x = [1 2 3 4 5];
y = [1.13465 1.17166 1.19973 1.78338 1.83673
3.96e-12 3.6e-11 0.109991 1.0131 1.57166
0.574522 0.619429 0.685391 1.21099 1.73831
1.27e-11 0.142583 0.308049 0.890379 1.38142
3.5e-12 0.0606085 0.137094 0.565742 0.915032
1.77e-11 0.0206984 0.096124 0.213596 0.548369
0.343735 0.358206 0.386193 1.04343 1.80219
0.342868 0.333045 0.341806 0.760036 1.41684
0.423389 0.412866 0.415499 0.569211 0.564488
4e-12 3.67e-11 0.109991 1.0131 1.57166
0.692851 0.696025 0.704127 1.30321 1.88094
5.5e-11 0.0395349 0.180155 0.639514 1.04088];
boxplot(x,y)
this is the code that I used,
but when I tried to plot, it said
‘The function ‘boxplot’ is not defined for inputs of type ‘double’.
Error occurred: untitled (line 22) boxplot(x,y)’
Can anyone help me to solve the problem?
Thank you! Hello, I am trying to plot boxplot.
x = [1 2 3 4 5];
y = [1.13465 1.17166 1.19973 1.78338 1.83673
3.96e-12 3.6e-11 0.109991 1.0131 1.57166
0.574522 0.619429 0.685391 1.21099 1.73831
1.27e-11 0.142583 0.308049 0.890379 1.38142
3.5e-12 0.0606085 0.137094 0.565742 0.915032
1.77e-11 0.0206984 0.096124 0.213596 0.548369
0.343735 0.358206 0.386193 1.04343 1.80219
0.342868 0.333045 0.341806 0.760036 1.41684
0.423389 0.412866 0.415499 0.569211 0.564488
4e-12 3.67e-11 0.109991 1.0131 1.57166
0.692851 0.696025 0.704127 1.30321 1.88094
5.5e-11 0.0395349 0.180155 0.639514 1.04088];
boxplot(x,y)
this is the code that I used,
but when I tried to plot, it said
‘The function ‘boxplot’ is not defined for inputs of type ‘double’.
Error occurred: untitled (line 22) boxplot(x,y)’
Can anyone help me to solve the problem?
Thank you! boxplot, typedouble MATLAB Answers — New Questions