Category: Matlab
Category Archives: Matlab
how to use NARX tool for a vectors of input to output?
I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model?I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model? I have a input of matrix sample N = 100 with time span of 30 seconds with discretization with dt = 0.01. Input of and for and the corresponding output for . How can I use the "NARX Neural Networks" for the above data. Please refer above DATA.mat file . How could the vector 100 samples are used for training and validate the trained model? narxnet, deep learning with time series MATLAB Answers — New Questions
Table comparing Session Based Interface and Legacy Interface on daq toolbox
Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ?Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ? Is there a complete list of daq commands that shows the Session-based command for corresponding Legacy Interface ? For example, ‘daqhwinfo’ there is a small grey box note that says:
_"Note: You cannot use the legacy interface on 64–bit MATLAB. See Using the Session-Based Interface to acquire and generate data."_
It would be nice if this links to corresponding Session-based command instead of leaving us trying to figure it out. Very annoying.
Does such a list exist where I can search for legacy command and find corresponding session-based command ? ni-daq, session based interface, legacy interface, daq toolbox MATLAB Answers — New Questions
Model of two differential equations of RLC circuit (Simulink)
Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model?Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model? Hello,
I have made an RLC circuit and I want to simulate this system. I know, that I can model the exact same circuit, but I want to get graphs from my two differential equations. I am kinda struggling with the model of those equations. I have already read a lot of articles, but i still can not figure out, how to apply the knowledge from those articles and from my self-studying.
I have those differential equations:
where U is voltage (I will probably use sinwave block); i1, i2, i3 are 3 currents.
Could somebody, please, give me a hint or any simillar example of Simulink model? simulink, rlc, two differential equations, matlab, graphs, voltage, current MATLAB Answers — New Questions
Unable to resolve the name audio.internal.visualizer.Filter.
Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks!Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks! Hello!
I keep getting the following error when executing the script AudioSystemToolboxIntroMain.m that accopanies the webinar "Real-time Audio Processing for Algorithm Prototyping and Custom Measurements" (https://se.mathworks.com/videos/real-time-audio-processing-for-algorithm-prototyping-and-custom-measurements-121075.html):
(Executing RealTimeStreaming.m works.)
Unable to resolve the name audio.internal.visualizer.Filter.
Error in ThreeBandParamEQ/visualize (line 122)
obj.visualObj = audio.internal.visualizer.Filter(coeffs,…
Error in AudioSystemToolboxIntroMain (line 10)
visualize(eq)
I believe that I have all required toolboxes installed:
>> ver
—————————————————————————————————–
MATLAB Version: 9.9.0.1467703 (R2020b)
MATLAB License Number: XXX
Operating System: Mac OS X Version: 10.15.7 Build: 19H2
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
—————————————————————————————————–
MATLAB Version 9.9 (R2020b)
Simulink Version 10.2 (R2020b)
Antenna Toolbox Version 4.3 (R2020b)
Audio Toolbox Version 2.3 (R2020b)
Computer Vision Toolbox Version 9.3 (R2020b)
Curve Fitting Toolbox Version 3.5.12 (R2020b)
DSP System Toolbox Version 9.11 (R2020b)
Image Acquisition Toolbox Version 6.3 (R2020b)
Image Processing Toolbox Version 11.2 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
MATLAB Compiler SDK Version 6.9 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Phased Array System Toolbox Version 4.4 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
Statistics and Machine Learning Toolbox Version 12.0 (R2020b)
Symbolic Math Toolbox Version 8.6 (R2020b)
I’ve tried
rehash toolboxcache
and reverting pathdef.m without success.
Thanks! audio MATLAB Answers — New Questions
how to get the pixel value of histogram?
Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30.Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30. Hello
i wants to delete or make some pixel zero , according to the bins.
im = imread (‘image’);
hsv_im = rgb2hsv(im);
h = hsv_im(:,:,1)
[pixelCount, grayLevels] = hist(h(:), 360);
pixelCount(20:30)=0;
Now i want to get my ‘Hue’ Matrix with same pixel position and zeros between the bin values from 20 to 30. image processing, digital image processing, image analysis, image segmentation MATLAB Answers — New Questions
Pre-emphasis filter
Hello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pauseHello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pause Hello everybody
My question is:-
firstly,I should record any speech signal with 8KHZ and 8 bit and I don’t know how can I apply speech signal with (8KHZ and 8 bit)
and then I must pass this speech signal throw pre-emphasis filter and finaly I listen to the differencr after and before filtering.
But another confusing thing for me that my pro said I must use cinvolution in my program
And I did my program but I’m not sure from it because I have error like this
??? Error using ==> conv at 27
A and B must be vectors.
Error in ==> speech2 at 18
s3=conv(s1,ypre);
and I don’t know how can I add 8kHZ and 8 bit in true form in my program
The program:-
f=8000;
apre=[1];
[s1,f]=wavread(‘C:UsersNDesktopfamily.wav’);
figure(1)
plot(s1)
title(‘speech signal’);
sound(s1,f);
pause
% design pre-emphasis filter
bpre=[1 -0.95];
fvtool(bpre,apre);
ypre=filter(bpre,apre,s1);
figure(2)
plot(ypre);
title(‘First filter response’);
sound(ypre,f);
pause
s3=conv(s1,ypre);
figure(3);
plot(s3);
title(‘speech after filtering’);
sound(m,fs);
pause signal processing MATLAB Answers — New Questions
Cannot simulate flow rate changes in response to pressure differences in the air chamber
Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output.Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output. Cannot simulate flow rate changes in response to pressure differences in the air chamber
Two chambers with different initial pressures are connected by a Local Restriction (MA), which is commanded to close until a certain point in time and open after that time.
In this case, we expected that the chambers with different pressures would be connected at the timing when Local Restriction was opened, and air would move from the chamber with the higher pressure to the chamber with the lower pressure.
However, the result was that terminal A of Local Restriction was below the minimum effective pressure and an error occurred.
The settings are: chamber 1 initial pressure is 10.13 kPa; chamber 2 initial pressure is 101.3 kPa; Local Restriction is fully opened after 360 second.
Please tell me how to create a model in which air moves according to the pressure difference between chambers.
The attached image shows the model and output. simulink, simscape, simscape fluide MATLAB Answers — New Questions
Serial reading and splitting data needs to be faster
The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm);The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm); The serial has to be read and the data has to be converged to a easy readable double matrix like …x1 double. I need to read the buffer and creates this matrix quickly so other code can run after. Reading the buffer is quick (0.5s), but I would like a speed improvement for creating the matrix (11s). Any ideas?
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 100000000; %100MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = cell(amount,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
data{i} = fscanf(stm);
end
toc;
% fclose(stm);
%This part is slower
num_chunks = 8192;
len = length(data);
tic;
chunks = zeros(len*num_chunks, 1);
for a = 1:length(data)
data_buffer = cell2mat(data(a));
for i = 1:num_chunks
start_index = (i – 1) * 4 + 1;
end_index = start_index + 3;
chunks((a-1)*num_chunks+i,1) = str2double(data_buffer(start_index:end_index));
end
end
toc;
fscanf(stm); gives 1×32769 char
e.g. 3036303630343035303630363036303230333035303530353034303430363035303330333033303530353034303530353034303530313032303830353035303530343036303230343034303430363036303530343032303330343033303430353034303530353035303230333033303730343034303230323034303330283032
This code is even slower
% stm = serial("COM5", ‘Baudrate’, 2000000);
% stm.InputBufferSize = 200000000; %200MB buffer, max is 2GB
% fopen(stm);
amount = 200;
data = zeros(amount*8192,1);
NotFullData = fscanf(stm); %make sure adc is on before sending and discard this
tic;
for i=1:1:amount
read_data = fscanf(stm);
data_temp = str2double(cellstr(reshape(read_data(1:end-1),4,[])’));
for a=1:1:8192
data((i-1)*8192+a) = data_temp(a);
end
end
toc;
% fclose(stm); serial MATLAB Answers — New Questions
how to access Simulink Compiler (or any other way for real-time app designer and simulink interface)?
Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler)Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler) Target: Real-time interface between app designer and simulink (found some appropriate solution if use Simulink Compiler but unable to access or use this Compiler) interface real-time, simulink, appdesigner MATLAB Answers — New Questions
Problem with Simulink Onramp Task 7.2
Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself.Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself. Hi,
During the Simulink Onramp, I’ve stranded on Task 7.2 with the following issue. All code is correct and checked a few times now. Since I don’t know the function that errors or what input is of type char, I’m stuck. I’ve tested to replace the MATLAB function with the fcn-block and then everything works fine. As soon as I add a MATLAB function block, i get the error – no matter if it is the prepared block from the task or a nex from simulink. It does not matter what code I fill it with, so it feels like there is a missmatch in the communication from Simulink into the block type itself. simulink onramp, task 7.2, matlab function block MATLAB Answers — New Questions
Use a compiled Library .a extension in simulink
Hello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSAHello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSA Hello,
I have a compiled library file .a extension, I need to import this file into simulink and use it in my simulation activities. How can I use this file in simulink? I need to integrate it as a block in a big model?
Thank you in advance for your response.
Regards,
Ali ISSA import library, simulink MATLAB Answers — New Questions
Fitting a function with constraints
Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax)Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax) Hi
I am currently struggling to fit a 2nd order polynomial function with specific constraints.
I have an external script that tells me wether the polynomial function is ascending, descending or u-shaped.
Therefore I’ve made a constraints (using the "fit" command) for the x^2 part to only be positive because I can only use downwards curves.
This is my current formula:
[p,gof] = fit(x,y,’poly2′,’lower’,[0,-inf,-inf],’normalize’,’on’)
Now I need to give specific constraint for each shape:
ascending: The minimum y-value must be at the first x-value (ymin = xmin)
descending: The minimum y-value must be at the last x-value (ymin = xmax)
U-curve: The minimum y-value must be in between the first and last x-value (xmin < ymin < xmax) curve fitting MATLAB Answers — New Questions
Is it possible to merge two experience buffers generated during training of the same agent?
Hallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
YoursHallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
Yours Hallo,
I have trained an agent on two PCs for a while and got two "agent" objects with respective experience buffers. As these two were generated during training of same agent interacting with same environment, I am wondering if it is possible to merge these two and continue training with merged experience buffer.
Yours reinforcement learning, experience buffer MATLAB Answers — New Questions
Unable to download Support Package
Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>>Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>> Hello, Does anyone of you could share the offline files of the support packages for Texas Instruments C2000 and/or Arduino DUE under Matlab r2015b (win32). I ve tried all techniques to solve this issue but end up with no solutions. It seems that Mathworks’ servers reject every download from this release (cf. Picture)!
<</matlabcentral/answers/uploaded_files/1708621/w2.jpg>> support-package, tic2000, arduino MATLAB Answers — New Questions
Flexible Body Model Builder – What causes unexpected error?
Hello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
AtliHello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
Atli Hello everyone,
I’m working with a relatively complex goemetry in the FlexibleBodyModelBuilder tool. It’s a thin-walled structure with the thinnest walls being 1mm thick. I set the min element size to 0,5mm. I’ve tried both ROM generators and run into unexpected errors
Any idea what could be wrong? Is my geometry just too complex? Any insights are much apprecieated!
Best regards,
Atli flexiblebodymodelbuilder, unexpected error, rom generator, complex geometry MATLAB Answers — New Questions
xline issue with adding a number to the line through the labels option
Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments.Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments. Is there a reason why the xline (or yline) functions won’t accept a number converted to a string
c=b(3); %Breakpoint
cs=num2str(c)
class(cs)
xline(ax3,c,cs);
cs =
‘125.7048’
ans =
‘char’
Error using xline
Invalid parameter/value pair arguments. xline, yline MATLAB Answers — New Questions
Baseband IQ to RF Signal Generation
Body:
I’m working on the IQmod example in MATLAB and attempting to generate a 4FSK signal for transmission at 150 MHz. However, I’m unclear about how to control the center frequency of the transmitted signal.
Current Approach:
I’ve tried using the center frequency option in the inport block, but it doesn’t seem to affect the transmission frequency.
The iqmodulator block offers a local Oscillator option, but its purpose in setting the center frequency isn’t entirely clear.
My Question:
How can I properly set the center frequency to 150 MHz for transmitting the 4FSK signal using the IQmod example? Should I be modulating the baseband signal with a carrier at 150 MHz before feeding it to iqmodulator? Or is there another approach within the existing structure?
Additional Information:
I’m using a sampling rate of 1 MHz for the IQ data.Body:
I’m working on the IQmod example in MATLAB and attempting to generate a 4FSK signal for transmission at 150 MHz. However, I’m unclear about how to control the center frequency of the transmitted signal.
Current Approach:
I’ve tried using the center frequency option in the inport block, but it doesn’t seem to affect the transmission frequency.
The iqmodulator block offers a local Oscillator option, but its purpose in setting the center frequency isn’t entirely clear.
My Question:
How can I properly set the center frequency to 150 MHz for transmitting the 4FSK signal using the IQmod example? Should I be modulating the baseband signal with a carrier at 150 MHz before feeding it to iqmodulator? Or is there another approach within the existing structure?
Additional Information:
I’m using a sampling rate of 1 MHz for the IQ data. Body:
I’m working on the IQmod example in MATLAB and attempting to generate a 4FSK signal for transmission at 150 MHz. However, I’m unclear about how to control the center frequency of the transmitted signal.
Current Approach:
I’ve tried using the center frequency option in the inport block, but it doesn’t seem to affect the transmission frequency.
The iqmodulator block offers a local Oscillator option, but its purpose in setting the center frequency isn’t entirely clear.
My Question:
How can I properly set the center frequency to 150 MHz for transmitting the 4FSK signal using the IQmod example? Should I be modulating the baseband signal with a carrier at 150 MHz before feeding it to iqmodulator? Or is there another approach within the existing structure?
Additional Information:
I’m using a sampling rate of 1 MHz for the IQ data. simulink, communication, mfsk, iqmodulator MATLAB Answers — New Questions
counter that will count the input 1. If the input signal goes to 0 then the counter should reset.
I have to count every "True" signal and increment the counter by 1, when the signal is "True" and reset the counter to 0 when the signal is "False"I have to count every "True" signal and increment the counter by 1, when the signal is "True" and reset the counter to 0 when the signal is "False" I have to count every "True" signal and increment the counter by 1, when the signal is "True" and reset the counter to 0 when the signal is "False" counter MATLAB Answers — New Questions
127.0.0.1:31516 – Message service fatally disconnected
Hi,
I have a problem with Matlab (both R2023b and R2024a) not being able to resume after PC wakes from sleep mode. If Matlab is open when trying to put my PC to sleep, it stalls for several minutes preventing it from sleeping (until some process times out I guess and it finally enters sleep mode). Then, after it wakes, Matlab throws this error that Message service was disconnected at a specific localhost port (see title, the port number can vary). I followed advice from other posts (https://www.mathworks.com/matlabcentral/answers/514453-message-service-fatally-disconnected, https://www.mathworks.com/matlabcentral/answers/1637690-session-locks-when-connected-to-internet-after-disconnect-it-eventually-unlocks-with-matlab-error, and links within) that suggested to reset the preferences folder in AppData and download help documentation to local storage, but neither helped. This issue started in R2023b, recently I’ve upgraded to R2024a, but the issue still persists (this means I have a fresh install of R2024a that does this).
This disconnect issue causes the session to "freeze" – I can still write code into scripts and the GUI still responds, but I cannot execute any lines, and any edits in scripts cannot be saved (meaning that anything I write/edit will be lost). Restarting Matlab "fixes" this (until the next sleep mode), but that is not a solution for me. I use Windows 11 Home 23H2 with a Ryzen 3600, the Matlab is an Academic Total Headcount licence if any of that matters.Hi,
I have a problem with Matlab (both R2023b and R2024a) not being able to resume after PC wakes from sleep mode. If Matlab is open when trying to put my PC to sleep, it stalls for several minutes preventing it from sleeping (until some process times out I guess and it finally enters sleep mode). Then, after it wakes, Matlab throws this error that Message service was disconnected at a specific localhost port (see title, the port number can vary). I followed advice from other posts (https://www.mathworks.com/matlabcentral/answers/514453-message-service-fatally-disconnected, https://www.mathworks.com/matlabcentral/answers/1637690-session-locks-when-connected-to-internet-after-disconnect-it-eventually-unlocks-with-matlab-error, and links within) that suggested to reset the preferences folder in AppData and download help documentation to local storage, but neither helped. This issue started in R2023b, recently I’ve upgraded to R2024a, but the issue still persists (this means I have a fresh install of R2024a that does this).
This disconnect issue causes the session to "freeze" – I can still write code into scripts and the GUI still responds, but I cannot execute any lines, and any edits in scripts cannot be saved (meaning that anything I write/edit will be lost). Restarting Matlab "fixes" this (until the next sleep mode), but that is not a solution for me. I use Windows 11 Home 23H2 with a Ryzen 3600, the Matlab is an Academic Total Headcount licence if any of that matters. Hi,
I have a problem with Matlab (both R2023b and R2024a) not being able to resume after PC wakes from sleep mode. If Matlab is open when trying to put my PC to sleep, it stalls for several minutes preventing it from sleeping (until some process times out I guess and it finally enters sleep mode). Then, after it wakes, Matlab throws this error that Message service was disconnected at a specific localhost port (see title, the port number can vary). I followed advice from other posts (https://www.mathworks.com/matlabcentral/answers/514453-message-service-fatally-disconnected, https://www.mathworks.com/matlabcentral/answers/1637690-session-locks-when-connected-to-internet-after-disconnect-it-eventually-unlocks-with-matlab-error, and links within) that suggested to reset the preferences folder in AppData and download help documentation to local storage, but neither helped. This issue started in R2023b, recently I’ve upgraded to R2024a, but the issue still persists (this means I have a fresh install of R2024a that does this).
This disconnect issue causes the session to "freeze" – I can still write code into scripts and the GUI still responds, but I cannot execute any lines, and any edits in scripts cannot be saved (meaning that anything I write/edit will be lost). Restarting Matlab "fixes" this (until the next sleep mode), but that is not a solution for me. I use Windows 11 Home 23H2 with a Ryzen 3600, the Matlab is an Academic Total Headcount licence if any of that matters. matlab startup, message service MATLAB Answers — New Questions
How can I solve this problem?
%数据集中1-59样本为第一类,60-130第二类,131-178第三类
load wine.mat;%载入数据
train_wine = [wine(1:30,:);wine(60:95,:);wine(131:153,:)];%第一类的1-30,第二类60-95,第三类131-153作为训练集
train_wine_labels = [wine_labels(1:30);wine_labels(60:95);wine_labels(131:153)];%提取标签
test_wine = [wine(31:59,:);wine(96:130,:);wine(154:178,:)];%剩下样本作为测试集
test_wine_labels = [wine_labels(31:59);wine_labels(96:130);wine_labels(154:178)];%提取相应标签
[mtrain,ntrain] = size(train_wine);
[mtest,ntest] = size(test_wine);%数据预处理,归一化
datatest = [train_wine;test_wine];
[dataset_scale,ps] = mapminmax(dataset’,0,1);
dataset_scale = dataset_scale’;
train_wine = dataset_scale(1:mtrain,:);
test_wine = dataset_scale((mtrain+1):(mtrain+mtest),:);
%预测模型
model = svmtrain(train_wine_labels,train_wine,’-c 2 -g 1′);
[predict_label,accuracy] = svmpredict(test_wine_labels,test_wine,model);
函数或变量 ‘wine_labels’ 无法识别。
Function or variable ‘wine_labels’ is not recognised.%数据集中1-59样本为第一类,60-130第二类,131-178第三类
load wine.mat;%载入数据
train_wine = [wine(1:30,:);wine(60:95,:);wine(131:153,:)];%第一类的1-30,第二类60-95,第三类131-153作为训练集
train_wine_labels = [wine_labels(1:30);wine_labels(60:95);wine_labels(131:153)];%提取标签
test_wine = [wine(31:59,:);wine(96:130,:);wine(154:178,:)];%剩下样本作为测试集
test_wine_labels = [wine_labels(31:59);wine_labels(96:130);wine_labels(154:178)];%提取相应标签
[mtrain,ntrain] = size(train_wine);
[mtest,ntest] = size(test_wine);%数据预处理,归一化
datatest = [train_wine;test_wine];
[dataset_scale,ps] = mapminmax(dataset’,0,1);
dataset_scale = dataset_scale’;
train_wine = dataset_scale(1:mtrain,:);
test_wine = dataset_scale((mtrain+1):(mtrain+mtest),:);
%预测模型
model = svmtrain(train_wine_labels,train_wine,’-c 2 -g 1′);
[predict_label,accuracy] = svmpredict(test_wine_labels,test_wine,model);
函数或变量 ‘wine_labels’ 无法识别。
Function or variable ‘wine_labels’ is not recognised. %数据集中1-59样本为第一类,60-130第二类,131-178第三类
load wine.mat;%载入数据
train_wine = [wine(1:30,:);wine(60:95,:);wine(131:153,:)];%第一类的1-30,第二类60-95,第三类131-153作为训练集
train_wine_labels = [wine_labels(1:30);wine_labels(60:95);wine_labels(131:153)];%提取标签
test_wine = [wine(31:59,:);wine(96:130,:);wine(154:178,:)];%剩下样本作为测试集
test_wine_labels = [wine_labels(31:59);wine_labels(96:130);wine_labels(154:178)];%提取相应标签
[mtrain,ntrain] = size(train_wine);
[mtest,ntest] = size(test_wine);%数据预处理,归一化
datatest = [train_wine;test_wine];
[dataset_scale,ps] = mapminmax(dataset’,0,1);
dataset_scale = dataset_scale’;
train_wine = dataset_scale(1:mtrain,:);
test_wine = dataset_scale((mtrain+1):(mtrain+mtest),:);
%预测模型
model = svmtrain(train_wine_labels,train_wine,’-c 2 -g 1′);
[predict_label,accuracy] = svmpredict(test_wine_labels,test_wine,model);
函数或变量 ‘wine_labels’ 无法识别。
Function or variable ‘wine_labels’ is not recognised. 无法识别 MATLAB Answers — New Questions