Category: Matlab
Category Archives: Matlab
Creating a standalone .exe of an .m file that calls a simulink model
Hi,
I have a .m file that controls a gui. A slider in the gui is used as input for a simulink model. My goal is to create a standalone of this whole application, that runs on a PC where neither Matlab nor Simulink are installed.
My approach so far is to generate a standalone .exe out of the simulink model, modify the .m script to pass the input values to this .exe and get the output values, and then generate a .exe out of the .m script.
I have several questions on how to do this:
# Is this the correct approach or would it be better to create a dll out of the simulink model?
# If this is the way to go, which target in the code generation allows the easiest passing of values to the simulink model .exe? I found three different options: ert_shrlib (host based shared library), grt (Generic Realtime Target) and rsim (Rapid Simulation Target). Which of these should I use?
# Are there any step-by-step instructions on how to accomplish this? Or even examples of a similar project?
Thanks you very much!Hi,
I have a .m file that controls a gui. A slider in the gui is used as input for a simulink model. My goal is to create a standalone of this whole application, that runs on a PC where neither Matlab nor Simulink are installed.
My approach so far is to generate a standalone .exe out of the simulink model, modify the .m script to pass the input values to this .exe and get the output values, and then generate a .exe out of the .m script.
I have several questions on how to do this:
# Is this the correct approach or would it be better to create a dll out of the simulink model?
# If this is the way to go, which target in the code generation allows the easiest passing of values to the simulink model .exe? I found three different options: ert_shrlib (host based shared library), grt (Generic Realtime Target) and rsim (Rapid Simulation Target). Which of these should I use?
# Are there any step-by-step instructions on how to accomplish this? Or even examples of a similar project?
Thanks you very much! Hi,
I have a .m file that controls a gui. A slider in the gui is used as input for a simulink model. My goal is to create a standalone of this whole application, that runs on a PC where neither Matlab nor Simulink are installed.
My approach so far is to generate a standalone .exe out of the simulink model, modify the .m script to pass the input values to this .exe and get the output values, and then generate a .exe out of the .m script.
I have several questions on how to do this:
# Is this the correct approach or would it be better to create a dll out of the simulink model?
# If this is the way to go, which target in the code generation allows the easiest passing of values to the simulink model .exe? I found three different options: ert_shrlib (host based shared library), grt (Generic Realtime Target) and rsim (Rapid Simulation Target). Which of these should I use?
# Are there any step-by-step instructions on how to accomplish this? Or even examples of a similar project?
Thanks you very much! simulink, matlab MATLAB Answers — New Questions
CORRECT THE FOLLOWING MATLAB SCRIPT, error in =untitled3 (line 8) / sys = ss(A, B, C, D); ???
% Definisikan matriks G
G = [
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1;
1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0;
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0;
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
];
% Misalkan A, B, C, D adalah matriks untuk sistem ruang keadaan
A = eye(8); % Matriks A identitas ukuran 8×8
B = ones(8, 1); % Matriks B ukuran 8×1 dengan semua elemen 1
C = G; % Menggunakan G sebagai matriks C
D = zeros(size(C, 1), size(B, 2)); % Matriks D ukuran (8×1)
% Buat model ruang keadaan
sys = ss(A, B, C, D); % Buat model ruang keadaan
% Analisis sistem
figure; % Membuat figure baru untuk plot
step(sys); % Analisis respons langkah
title(‘Respons Langkah Sistem Ruang Keadaan’); % Tambahkan judul
grid on; % Tambahkan grid untuk memperjelas plot% Definisikan matriks G
G = [
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1;
1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0;
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0;
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
];
% Misalkan A, B, C, D adalah matriks untuk sistem ruang keadaan
A = eye(8); % Matriks A identitas ukuran 8×8
B = ones(8, 1); % Matriks B ukuran 8×1 dengan semua elemen 1
C = G; % Menggunakan G sebagai matriks C
D = zeros(size(C, 1), size(B, 2)); % Matriks D ukuran (8×1)
% Buat model ruang keadaan
sys = ss(A, B, C, D); % Buat model ruang keadaan
% Analisis sistem
figure; % Membuat figure baru untuk plot
step(sys); % Analisis respons langkah
title(‘Respons Langkah Sistem Ruang Keadaan’); % Tambahkan judul
grid on; % Tambahkan grid untuk memperjelas plot % Definisikan matriks G
G = [
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1;
1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0;
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0;
0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1;
];
% Misalkan A, B, C, D adalah matriks untuk sistem ruang keadaan
A = eye(8); % Matriks A identitas ukuran 8×8
B = ones(8, 1); % Matriks B ukuran 8×1 dengan semua elemen 1
C = G; % Menggunakan G sebagai matriks C
D = zeros(size(C, 1), size(B, 2)); % Matriks D ukuran (8×1)
% Buat model ruang keadaan
sys = ss(A, B, C, D); % Buat model ruang keadaan
% Analisis sistem
figure; % Membuat figure baru untuk plot
step(sys); % Analisis respons langkah
title(‘Respons Langkah Sistem Ruang Keadaan’); % Tambahkan judul
grid on; % Tambahkan grid untuk memperjelas plot #help MATLAB Answers — New Questions
Not able to see where the index is going past 5
load(‘Motor_Data.mat’);
fprintf(‘Available motors:n’);
for i = 1:length(Names)
fprintf(‘%d: %sn’, i, Names(i));
end
motor_index = input(‘Select a motor by entering its number: ‘);
mass = input(‘Enter the mass to be lifted (in kg): ‘);
height = input(‘Enter the height to lift the mass (in meters): ‘);
%Says this is where it errors
motor_name = Names(motor_index);
power = Specs(1, motor_index);
efficiency = Specs(2, motor_index);
% Calculate output power
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
g = 9.81;
energy_required = mass * g * height;
time = energy_required / output_power;
fprintf(‘Motor: %sn’, motor_name);
fprintf(‘Load lifted: %.2f kgn’, mass);
fprintf(‘Height lifted: %.2f metersn’, height);
fprintf(‘Time to lift the load: %.2f secondsn’, time);
%Task 2
mass = input(‘Enter the mass to be lifted by all motors (in kg): ‘);
height = input(‘Enter the height to lift the mass by all motors (in meters): ‘);
% Initialize results matrix
num_motors = length(Names);
results = zeros(5, num_motors);
% Calculate time for each motor
g = 9.81; % Gravity constant
for i = 1:num_motors
power = Specs(1, i); % Power in watts
efficiency = Specs(2, i); % Efficiency in percentage
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
% Energy required to lift mass
energy_required = mass * g * height;
% Time to lift
time = energy_required / output_power;
% Store results: power, efficiency, mass, height, time
results(:, i) = [power; efficiency; mass; height; time];
end
% Export results to CSV file
csvwrite(‘Task2_Results.csv’, results);
% Display the matrix to verify
disp(‘Results matrix:’);
disp(results);
%Task 3
output_powers = Specs(1, 🙂 .* (Specs(2, 🙂 / 100); % Output power for each motor
times = results(5, :); % Time from the results matrix
scatter(output_powers, times, ‘filled’);
xlabel(‘Output Power (W)’);
ylabel(‘Time to Lift Load (s)’);
title(‘Motor Output Power vs. Time to Lift Load’);
grid on;load(‘Motor_Data.mat’);
fprintf(‘Available motors:n’);
for i = 1:length(Names)
fprintf(‘%d: %sn’, i, Names(i));
end
motor_index = input(‘Select a motor by entering its number: ‘);
mass = input(‘Enter the mass to be lifted (in kg): ‘);
height = input(‘Enter the height to lift the mass (in meters): ‘);
%Says this is where it errors
motor_name = Names(motor_index);
power = Specs(1, motor_index);
efficiency = Specs(2, motor_index);
% Calculate output power
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
g = 9.81;
energy_required = mass * g * height;
time = energy_required / output_power;
fprintf(‘Motor: %sn’, motor_name);
fprintf(‘Load lifted: %.2f kgn’, mass);
fprintf(‘Height lifted: %.2f metersn’, height);
fprintf(‘Time to lift the load: %.2f secondsn’, time);
%Task 2
mass = input(‘Enter the mass to be lifted by all motors (in kg): ‘);
height = input(‘Enter the height to lift the mass by all motors (in meters): ‘);
% Initialize results matrix
num_motors = length(Names);
results = zeros(5, num_motors);
% Calculate time for each motor
g = 9.81; % Gravity constant
for i = 1:num_motors
power = Specs(1, i); % Power in watts
efficiency = Specs(2, i); % Efficiency in percentage
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
% Energy required to lift mass
energy_required = mass * g * height;
% Time to lift
time = energy_required / output_power;
% Store results: power, efficiency, mass, height, time
results(:, i) = [power; efficiency; mass; height; time];
end
% Export results to CSV file
csvwrite(‘Task2_Results.csv’, results);
% Display the matrix to verify
disp(‘Results matrix:’);
disp(results);
%Task 3
output_powers = Specs(1, 🙂 .* (Specs(2, 🙂 / 100); % Output power for each motor
times = results(5, :); % Time from the results matrix
scatter(output_powers, times, ‘filled’);
xlabel(‘Output Power (W)’);
ylabel(‘Time to Lift Load (s)’);
title(‘Motor Output Power vs. Time to Lift Load’);
grid on; load(‘Motor_Data.mat’);
fprintf(‘Available motors:n’);
for i = 1:length(Names)
fprintf(‘%d: %sn’, i, Names(i));
end
motor_index = input(‘Select a motor by entering its number: ‘);
mass = input(‘Enter the mass to be lifted (in kg): ‘);
height = input(‘Enter the height to lift the mass (in meters): ‘);
%Says this is where it errors
motor_name = Names(motor_index);
power = Specs(1, motor_index);
efficiency = Specs(2, motor_index);
% Calculate output power
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
g = 9.81;
energy_required = mass * g * height;
time = energy_required / output_power;
fprintf(‘Motor: %sn’, motor_name);
fprintf(‘Load lifted: %.2f kgn’, mass);
fprintf(‘Height lifted: %.2f metersn’, height);
fprintf(‘Time to lift the load: %.2f secondsn’, time);
%Task 2
mass = input(‘Enter the mass to be lifted by all motors (in kg): ‘);
height = input(‘Enter the height to lift the mass by all motors (in meters): ‘);
% Initialize results matrix
num_motors = length(Names);
results = zeros(5, num_motors);
% Calculate time for each motor
g = 9.81; % Gravity constant
for i = 1:num_motors
power = Specs(1, i); % Power in watts
efficiency = Specs(2, i); % Efficiency in percentage
efficiency_decimal = efficiency / 100;
output_power = efficiency_decimal * power;
% Energy required to lift mass
energy_required = mass * g * height;
% Time to lift
time = energy_required / output_power;
% Store results: power, efficiency, mass, height, time
results(:, i) = [power; efficiency; mass; height; time];
end
% Export results to CSV file
csvwrite(‘Task2_Results.csv’, results);
% Display the matrix to verify
disp(‘Results matrix:’);
disp(results);
%Task 3
output_powers = Specs(1, 🙂 .* (Specs(2, 🙂 / 100); % Output power for each motor
times = results(5, :); % Time from the results matrix
scatter(output_powers, times, ‘filled’);
xlabel(‘Output Power (W)’);
ylabel(‘Time to Lift Load (s)’);
title(‘Motor Output Power vs. Time to Lift Load’);
grid on; matlab MATLAB Answers — New Questions
Eliminate Nan row in a large matrix
Hello,
I have a very large matrix where some elements are Nan.
I would like to delete the rows containing the these elements.
Example
For
A=[1 2 3; 2 4 Nan; 4 5 6; nan 9 0];
Output:
A=[1 2 3];
Any ideas?
Thank youHello,
I have a very large matrix where some elements are Nan.
I would like to delete the rows containing the these elements.
Example
For
A=[1 2 3; 2 4 Nan; 4 5 6; nan 9 0];
Output:
A=[1 2 3];
Any ideas?
Thank you Hello,
I have a very large matrix where some elements are Nan.
I would like to delete the rows containing the these elements.
Example
For
A=[1 2 3; 2 4 Nan; 4 5 6; nan 9 0];
Output:
A=[1 2 3];
Any ideas?
Thank you nan deletion MATLAB Answers — New Questions
Can’t start MatLab Onramp Course
As I’m trying to start the course it gives me an error of this kind:
HTTP ERROR 431 Request Header Fields Too Large
URI:/R2024a/portal.html?course=gettingstarted
STATUS:431
MESSAGE:Request Header Fields Too Large
Tried to fix it by clearing cache but didn’t help at all. What can I do to get the course started?As I’m trying to start the course it gives me an error of this kind:
HTTP ERROR 431 Request Header Fields Too Large
URI:/R2024a/portal.html?course=gettingstarted
STATUS:431
MESSAGE:Request Header Fields Too Large
Tried to fix it by clearing cache but didn’t help at all. What can I do to get the course started? As I’m trying to start the course it gives me an error of this kind:
HTTP ERROR 431 Request Header Fields Too Large
URI:/R2024a/portal.html?course=gettingstarted
STATUS:431
MESSAGE:Request Header Fields Too Large
Tried to fix it by clearing cache but didn’t help at all. What can I do to get the course started? course, error MATLAB Answers — New Questions
Machine learning in matlab
Can i call the matpower file in matlab using machine learning?Can i call the matpower file in matlab using machine learning? Can i call the matpower file in matlab using machine learning? matpower, machine learning MATLAB Answers — New Questions
Python Script Simulink Real Time
Good afternoon,
In Simulink you can intergrate Python script into the model, does that also work for External Mode Simulation for Simulink Real Time?
Kind regards,
DiedeGood afternoon,
In Simulink you can intergrate Python script into the model, does that also work for External Mode Simulation for Simulink Real Time?
Kind regards,
Diede Good afternoon,
In Simulink you can intergrate Python script into the model, does that also work for External Mode Simulation for Simulink Real Time?
Kind regards,
Diede python, simulink, real time, matlab MATLAB Answers — New Questions
Run Initialization for Task (5) Mask creation
I need to ensure that the string is up to date by running the mask initialization commands I wrote in the previous task. However, I’m unable to find a way to do this or the code to run the initialization. The attached images provides additional context.
Could you please guide me through the process or help with the necessary code?
How can I run the initialization so that the label on the mask display is Kp=50 and Ki=50 just like the codes in the second image.I need to ensure that the string is up to date by running the mask initialization commands I wrote in the previous task. However, I’m unable to find a way to do this or the code to run the initialization. The attached images provides additional context.
Could you please guide me through the process or help with the necessary code?
How can I run the initialization so that the label on the mask display is Kp=50 and Ki=50 just like the codes in the second image. I need to ensure that the string is up to date by running the mask initialization commands I wrote in the previous task. However, I’m unable to find a way to do this or the code to run the initialization. The attached images provides additional context.
Could you please guide me through the process or help with the necessary code?
How can I run the initialization so that the label on the mask display is Kp=50 and Ki=50 just like the codes in the second image. mask editor, run initialization MATLAB Answers — New Questions
py.importlib.import_module(‘gplearn’) ???
gplearn = py.importlib.import_module(‘gplearn’);
sklearn = py.importlib.import_module(‘sklearn’);
why they are different???gplearn = py.importlib.import_module(‘gplearn’);
sklearn = py.importlib.import_module(‘sklearn’);
why they are different??? gplearn = py.importlib.import_module(‘gplearn’);
sklearn = py.importlib.import_module(‘sklearn’);
why they are different??? python MATLAB Answers — New Questions
Error: Unable to update models referenced by Testsystem_w_CLB.
Testsystem_w_CLB is the project.
Caused by: Error encountered while building "SmartValveControls_msf"
SmartValveControls_msf is MATLAB mex file.
any one can suggest how to fix the error.Testsystem_w_CLB is the project.
Caused by: Error encountered while building "SmartValveControls_msf"
SmartValveControls_msf is MATLAB mex file.
any one can suggest how to fix the error. Testsystem_w_CLB is the project.
Caused by: Error encountered while building "SmartValveControls_msf"
SmartValveControls_msf is MATLAB mex file.
any one can suggest how to fix the error. error in building the matlab mex file MATLAB Answers — New Questions
Cooperative spectral sensing with majority fusion rule
I´m MSc student.
I´m doing my thesis on "cooperative spectral sensing with majority fusion rule, energy detector". So ,i need matlab code for it. Anyone who can provide me a basic code pls.
My email: alcides.tomas@mtel.inatel.brI´m MSc student.
I´m doing my thesis on "cooperative spectral sensing with majority fusion rule, energy detector". So ,i need matlab code for it. Anyone who can provide me a basic code pls.
My email: alcides.tomas@mtel.inatel.br I´m MSc student.
I´m doing my thesis on "cooperative spectral sensing with majority fusion rule, energy detector". So ,i need matlab code for it. Anyone who can provide me a basic code pls.
My email: alcides.tomas@mtel.inatel.br cooperative spectral sensing, cognitive radio, majoritary fusion rule, energy detector MATLAB Answers — New Questions
How to improve precision of lsqnonlin analysis
I used lsqnonlin annlysis to fit a model to two sets of data. The results showed that the differences between original data and fitted line are rather huge (see in Figure1). How to improve this analysis to obtain better results? Thanks! Below are my codes.
function Result = myfunc1(a,p,G,m,fraction)
totalconcentration = 0.0000254;
n = 2;
K = exp(-((G + m .* fraction)./(8.314*298)));
opts = optimoptions(‘fsolve’,’Algorithm’, ‘levenberg-marquardt’,’FunctionTolerance’,1.0000e-12);
monomerconcentration = fsolve(@denaturationfun,0.999,opts);
function y = denaturationfun(x)
y = K.*totalconcentration – a.^(-1).*(((a.*x).^(n+1)).*(n.*a.*x-n-1)./((a.*x-1).^2)+a.*x./((a.*x-1).^2))+a.^(n-1).*((x^(n+1)).*(n.*x-n-1)./((x-1).^2));
end
Result = p * (1- (monomerconcentration ./ ( K * totalconcentration )));
end
clc;
clear;
close all;
fractiondata = [0.0431 0.0478 0.0525 0.0571 0.0617 0.0662 0.0707 0.0751 0.0795 0.0839 0.0882 0.0925 0.0967 0.1009 0.1051 0.1092 0.1133 0.1174 0.1253];
DegreeofAggdata = [0.86089 0.90051 0.84268 0.9543 0.98855 0.98538 1 0.98493 0.91339 0.92209 0.85817 0.78529 0.64172 0.45712 0.24855 0.11291 0.00812 0 0.0169];
fun = @(x)DegreeofAggdata – myfunc1(x(1),x(2),x(3),x(4),fractiondata);
x0 = [0.001,1,-50000,100000];
lb = [0,0.7,-150000,20000];
ub = [1,1.3,-5000,150000];
options = optimoptions(‘lsqnonlin’,’Algorithm’,’levenberg-marquardt’);
R = lsqnonlin(fun,x0,lb,ub); %% fit model to exp data
A = 0.03:0.001:0.15;
D = zeros(length(A),1);
for i = 1:length(A)
y = myfunc1(R(1),R(2),R(3),R(4),A(i));
D(i)= y;
end
figure(1);
plot(A,D,’r-‘); %% draw lines with fitted parameters
hold on;
plot (fractiondata,DegreeofAggdata,’-go’);I used lsqnonlin annlysis to fit a model to two sets of data. The results showed that the differences between original data and fitted line are rather huge (see in Figure1). How to improve this analysis to obtain better results? Thanks! Below are my codes.
function Result = myfunc1(a,p,G,m,fraction)
totalconcentration = 0.0000254;
n = 2;
K = exp(-((G + m .* fraction)./(8.314*298)));
opts = optimoptions(‘fsolve’,’Algorithm’, ‘levenberg-marquardt’,’FunctionTolerance’,1.0000e-12);
monomerconcentration = fsolve(@denaturationfun,0.999,opts);
function y = denaturationfun(x)
y = K.*totalconcentration – a.^(-1).*(((a.*x).^(n+1)).*(n.*a.*x-n-1)./((a.*x-1).^2)+a.*x./((a.*x-1).^2))+a.^(n-1).*((x^(n+1)).*(n.*x-n-1)./((x-1).^2));
end
Result = p * (1- (monomerconcentration ./ ( K * totalconcentration )));
end
clc;
clear;
close all;
fractiondata = [0.0431 0.0478 0.0525 0.0571 0.0617 0.0662 0.0707 0.0751 0.0795 0.0839 0.0882 0.0925 0.0967 0.1009 0.1051 0.1092 0.1133 0.1174 0.1253];
DegreeofAggdata = [0.86089 0.90051 0.84268 0.9543 0.98855 0.98538 1 0.98493 0.91339 0.92209 0.85817 0.78529 0.64172 0.45712 0.24855 0.11291 0.00812 0 0.0169];
fun = @(x)DegreeofAggdata – myfunc1(x(1),x(2),x(3),x(4),fractiondata);
x0 = [0.001,1,-50000,100000];
lb = [0,0.7,-150000,20000];
ub = [1,1.3,-5000,150000];
options = optimoptions(‘lsqnonlin’,’Algorithm’,’levenberg-marquardt’);
R = lsqnonlin(fun,x0,lb,ub); %% fit model to exp data
A = 0.03:0.001:0.15;
D = zeros(length(A),1);
for i = 1:length(A)
y = myfunc1(R(1),R(2),R(3),R(4),A(i));
D(i)= y;
end
figure(1);
plot(A,D,’r-‘); %% draw lines with fitted parameters
hold on;
plot (fractiondata,DegreeofAggdata,’-go’); I used lsqnonlin annlysis to fit a model to two sets of data. The results showed that the differences between original data and fitted line are rather huge (see in Figure1). How to improve this analysis to obtain better results? Thanks! Below are my codes.
function Result = myfunc1(a,p,G,m,fraction)
totalconcentration = 0.0000254;
n = 2;
K = exp(-((G + m .* fraction)./(8.314*298)));
opts = optimoptions(‘fsolve’,’Algorithm’, ‘levenberg-marquardt’,’FunctionTolerance’,1.0000e-12);
monomerconcentration = fsolve(@denaturationfun,0.999,opts);
function y = denaturationfun(x)
y = K.*totalconcentration – a.^(-1).*(((a.*x).^(n+1)).*(n.*a.*x-n-1)./((a.*x-1).^2)+a.*x./((a.*x-1).^2))+a.^(n-1).*((x^(n+1)).*(n.*x-n-1)./((x-1).^2));
end
Result = p * (1- (monomerconcentration ./ ( K * totalconcentration )));
end
clc;
clear;
close all;
fractiondata = [0.0431 0.0478 0.0525 0.0571 0.0617 0.0662 0.0707 0.0751 0.0795 0.0839 0.0882 0.0925 0.0967 0.1009 0.1051 0.1092 0.1133 0.1174 0.1253];
DegreeofAggdata = [0.86089 0.90051 0.84268 0.9543 0.98855 0.98538 1 0.98493 0.91339 0.92209 0.85817 0.78529 0.64172 0.45712 0.24855 0.11291 0.00812 0 0.0169];
fun = @(x)DegreeofAggdata – myfunc1(x(1),x(2),x(3),x(4),fractiondata);
x0 = [0.001,1,-50000,100000];
lb = [0,0.7,-150000,20000];
ub = [1,1.3,-5000,150000];
options = optimoptions(‘lsqnonlin’,’Algorithm’,’levenberg-marquardt’);
R = lsqnonlin(fun,x0,lb,ub); %% fit model to exp data
A = 0.03:0.001:0.15;
D = zeros(length(A),1);
for i = 1:length(A)
y = myfunc1(R(1),R(2),R(3),R(4),A(i));
D(i)= y;
end
figure(1);
plot(A,D,’r-‘); %% draw lines with fitted parameters
hold on;
plot (fractiondata,DegreeofAggdata,’-go’); lsqnonlin MATLAB Answers — New Questions
how image sharpening is perform in matlab?
please suggest.
% Filter 1
kernel3 = [-1 -1 -1; -1 8 -1; -1 -1 -1]/3;
% Filter the image. Need to cast to single so it can be floating point
% which allows the image to have negative values.
filteredImage = imfilter(single(im), kernel3);
filteredImage =im2double(filteredImage);
filteredImage =1.5 .*filteredImage;
figure(),imshow(filteredImage);
out1=imadd(im,filteredImage);
figure(), imshow(out1);
Z = imabsdiff(im,out1);
% figure(),
imtool(Z);please suggest.
% Filter 1
kernel3 = [-1 -1 -1; -1 8 -1; -1 -1 -1]/3;
% Filter the image. Need to cast to single so it can be floating point
% which allows the image to have negative values.
filteredImage = imfilter(single(im), kernel3);
filteredImage =im2double(filteredImage);
filteredImage =1.5 .*filteredImage;
figure(),imshow(filteredImage);
out1=imadd(im,filteredImage);
figure(), imshow(out1);
Z = imabsdiff(im,out1);
% figure(),
imtool(Z); please suggest.
% Filter 1
kernel3 = [-1 -1 -1; -1 8 -1; -1 -1 -1]/3;
% Filter the image. Need to cast to single so it can be floating point
% which allows the image to have negative values.
filteredImage = imfilter(single(im), kernel3);
filteredImage =im2double(filteredImage);
filteredImage =1.5 .*filteredImage;
figure(),imshow(filteredImage);
out1=imadd(im,filteredImage);
figure(), imshow(out1);
Z = imabsdiff(im,out1);
% figure(),
imtool(Z); image processing, image sharpening, image enhancement, sharpness MATLAB Answers — New Questions
how to display a string in simulink display block
In a simulink model ,i want to display the result in the display block of sinks library .result should be string,like if result is 1 than it should display on ,else if result is 0 it should display off.In a simulink model ,i want to display the result in the display block of sinks library .result should be string,like if result is 1 than it should display on ,else if result is 0 it should display off. In a simulink model ,i want to display the result in the display block of sinks library .result should be string,like if result is 1 than it should display on ,else if result is 0 it should display off. in simulink sinks library display block MATLAB Answers — New Questions
TI C2000 : In Simulink, how to set ePWM output to a GPIO pin ?
Hi Sir,
I am using TI C2000 processor(TMS320F28335), and had just placed an ePWM module into the Simulink and set some parameters.
(I guess C2833x is for TMS320F28335, am I correct ?)
now I want to set the ePWM output to a GPIO pin, but under "Hardware setting" -> "Hardware Implementation" -> "Target hardware resource"->"ePWM", there is no relevant settings for GPIO
On the other hand, refer to : www.mathworks.com/…/sub-modules-of-epwm-type-1-4.html
GPIO mapping for ePWM output can be set in the same window(the green mark in the below picture), I guess it’s due to different C2000 part (?)
I am new to both C2000 processor and Simulink, sorry for such a simple question, very appreciate for your help, thanks.Hi Sir,
I am using TI C2000 processor(TMS320F28335), and had just placed an ePWM module into the Simulink and set some parameters.
(I guess C2833x is for TMS320F28335, am I correct ?)
now I want to set the ePWM output to a GPIO pin, but under "Hardware setting" -> "Hardware Implementation" -> "Target hardware resource"->"ePWM", there is no relevant settings for GPIO
On the other hand, refer to : www.mathworks.com/…/sub-modules-of-epwm-type-1-4.html
GPIO mapping for ePWM output can be set in the same window(the green mark in the below picture), I guess it’s due to different C2000 part (?)
I am new to both C2000 processor and Simulink, sorry for such a simple question, very appreciate for your help, thanks. Hi Sir,
I am using TI C2000 processor(TMS320F28335), and had just placed an ePWM module into the Simulink and set some parameters.
(I guess C2833x is for TMS320F28335, am I correct ?)
now I want to set the ePWM output to a GPIO pin, but under "Hardware setting" -> "Hardware Implementation" -> "Target hardware resource"->"ePWM", there is no relevant settings for GPIO
On the other hand, refer to : www.mathworks.com/…/sub-modules-of-epwm-type-1-4.html
GPIO mapping for ePWM output can be set in the same window(the green mark in the below picture), I guess it’s due to different C2000 part (?)
I am new to both C2000 processor and Simulink, sorry for such a simple question, very appreciate for your help, thanks. c2000 MATLAB Answers — New Questions
LIN pack/unpack ldf file not working
hello everyone,
when i want to upload mine ldf file in th block i wil get a error messages.
error messages:error evaluating "maskParameterCallback" callback of lin unpack block (mask) ‘unittled/lin pack’.
insufficient number of outputs from right hand side of equal sign to satisfy assignmenthello everyone,
when i want to upload mine ldf file in th block i wil get a error messages.
error messages:error evaluating "maskParameterCallback" callback of lin unpack block (mask) ‘unittled/lin pack’.
insufficient number of outputs from right hand side of equal sign to satisfy assignment hello everyone,
when i want to upload mine ldf file in th block i wil get a error messages.
error messages:error evaluating "maskParameterCallback" callback of lin unpack block (mask) ‘unittled/lin pack’.
insufficient number of outputs from right hand side of equal sign to satisfy assignment ldf, pack, communication MATLAB Answers — New Questions
Calculate Bit Error Rate and Block Error Rate using MATLAB
I require a way to calculate Block Error and Bit Error Rate of QAM Signals. How should I take the approach.
eg: I have a TxData = [0.707+0.707*j,0.707-0.707*j, -0.707-0.707*j, -0.707+0.707*j] and RxData = [0.707-0.707*j,0.707-0.707*j, +0.707-0.707*j, -0.707-0.707*j]
I require Matlab code to calculate the Block and Bit error rate of these Tx and Rx Data.I require a way to calculate Block Error and Bit Error Rate of QAM Signals. How should I take the approach.
eg: I have a TxData = [0.707+0.707*j,0.707-0.707*j, -0.707-0.707*j, -0.707+0.707*j] and RxData = [0.707-0.707*j,0.707-0.707*j, +0.707-0.707*j, -0.707-0.707*j]
I require Matlab code to calculate the Block and Bit error rate of these Tx and Rx Data. I require a way to calculate Block Error and Bit Error Rate of QAM Signals. How should I take the approach.
eg: I have a TxData = [0.707+0.707*j,0.707-0.707*j, -0.707-0.707*j, -0.707+0.707*j] and RxData = [0.707-0.707*j,0.707-0.707*j, +0.707-0.707*j, -0.707-0.707*j]
I require Matlab code to calculate the Block and Bit error rate of these Tx and Rx Data. matlab, qam MATLAB Answers — New Questions
How to use two releases of MATLAB (R2017a and R2022b) simultaneously on my laptop?
I had one relaese of MATLAB R2022b installed on my system but it is missing the optimtool. Then I treid to install R2017a, it is not working. Instrad it gives me the license error. Further when I uninstall the 2nd one, then the system gives me the message " Deactivate the license. If you deactivate the license, all releases will not work on this system". How to solve this issue?I had one relaese of MATLAB R2022b installed on my system but it is missing the optimtool. Then I treid to install R2017a, it is not working. Instrad it gives me the license error. Further when I uninstall the 2nd one, then the system gives me the message " Deactivate the license. If you deactivate the license, all releases will not work on this system". How to solve this issue? I had one relaese of MATLAB R2022b installed on my system but it is missing the optimtool. Then I treid to install R2017a, it is not working. Instrad it gives me the license error. Further when I uninstall the 2nd one, then the system gives me the message " Deactivate the license. If you deactivate the license, all releases will not work on this system". How to solve this issue? matlab r2022b, matlab r2017a, two releases of matlab MATLAB Answers — New Questions
how to find LPC feature from speech to recognize human emotions in matlab? Please, can anyone help?
Can anyone provide LPC feature extraction matlab algorithm or code for speech emotion recognition?Can anyone provide LPC feature extraction matlab algorithm or code for speech emotion recognition? Can anyone provide LPC feature extraction matlab algorithm or code for speech emotion recognition? lpc feature MATLAB Answers — New Questions
Filename truncated in MATLAB
I am using a command:
[TestDefinitionFiles,testDefinitionFolder] = uigetfile(‘*.xlsx’,’Select one or more test definitions that you to execute’,’MultiSelect’,’on’);
When I load the excel file (Disabled_to_MoveMotor), I see it in TestDefinitionFiles as
Why is the name truncated or is anything wrong from the user’s side?
Thanks.I am using a command:
[TestDefinitionFiles,testDefinitionFolder] = uigetfile(‘*.xlsx’,’Select one or more test definitions that you to execute’,’MultiSelect’,’on’);
When I load the excel file (Disabled_to_MoveMotor), I see it in TestDefinitionFiles as
Why is the name truncated or is anything wrong from the user’s side?
Thanks. I am using a command:
[TestDefinitionFiles,testDefinitionFolder] = uigetfile(‘*.xlsx’,’Select one or more test definitions that you to execute’,’MultiSelect’,’on’);
When I load the excel file (Disabled_to_MoveMotor), I see it in TestDefinitionFiles as
Why is the name truncated or is anything wrong from the user’s side?
Thanks. excel, matlab MATLAB Answers — New Questions