Tag Archives: matlab
How to loop through values?
Let’s say I have 11 values of beta, evenly-spaced with linspace( ). And let’s say for each value of beta, I want to compute some things for a range of alpha values using alpha = linspace( ). How can I best do this? Currently, I do something tedious: I fix beta, run the code, press hold on in the Command Window, fix another value of beta, run code, press hold on, etc. I suspect there’s a better way to do this. Should I just write a for loop for beta = 0: 11 : pi? Thanks in advance.Let’s say I have 11 values of beta, evenly-spaced with linspace( ). And let’s say for each value of beta, I want to compute some things for a range of alpha values using alpha = linspace( ). How can I best do this? Currently, I do something tedious: I fix beta, run the code, press hold on in the Command Window, fix another value of beta, run code, press hold on, etc. I suspect there’s a better way to do this. Should I just write a for loop for beta = 0: 11 : pi? Thanks in advance. Let’s say I have 11 values of beta, evenly-spaced with linspace( ). And let’s say for each value of beta, I want to compute some things for a range of alpha values using alpha = linspace( ). How can I best do this? Currently, I do something tedious: I fix beta, run the code, press hold on in the Command Window, fix another value of beta, run code, press hold on, etc. I suspect there’s a better way to do this. Should I just write a for loop for beta = 0: 11 : pi? Thanks in advance. for loop MATLAB Answers — New Questions
At time 0.0 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step s
Post Content Post Content singularity in the solution, reducing the step size, simulink MATLAB Answers — New Questions
Scatter plot legend with multiple column ?
Hi everyone,
I saw an interesting plot on a presentation for its legend (content apart):
I am wondering how I can recreate a plot with a similar legend. I am using Matlab2024a. Something like this would greatly improve the readibility of my plot beacuse it reduces the numer of marker shapes.
EXAMPLE –> Let us say each point in my scatter plot belong to two categories: apple and oranges. However, there are different kinds of these fruits. Therefore, I would like to classify them based on their kinds in the legend. In practice, the items on the legend should be similar to the one above. Filled and not filled markers to distinguish the kind of fruits. In the bottom of the legend, something similar to "Single-channel" and "Time-interleaving" above to put the names of the kinds. Different markers, instead, expresses apple and oranges.
Do you have any idea if this is possible in matlab ?
Thank you in advance !Hi everyone,
I saw an interesting plot on a presentation for its legend (content apart):
I am wondering how I can recreate a plot with a similar legend. I am using Matlab2024a. Something like this would greatly improve the readibility of my plot beacuse it reduces the numer of marker shapes.
EXAMPLE –> Let us say each point in my scatter plot belong to two categories: apple and oranges. However, there are different kinds of these fruits. Therefore, I would like to classify them based on their kinds in the legend. In practice, the items on the legend should be similar to the one above. Filled and not filled markers to distinguish the kind of fruits. In the bottom of the legend, something similar to "Single-channel" and "Time-interleaving" above to put the names of the kinds. Different markers, instead, expresses apple and oranges.
Do you have any idea if this is possible in matlab ?
Thank you in advance ! Hi everyone,
I saw an interesting plot on a presentation for its legend (content apart):
I am wondering how I can recreate a plot with a similar legend. I am using Matlab2024a. Something like this would greatly improve the readibility of my plot beacuse it reduces the numer of marker shapes.
EXAMPLE –> Let us say each point in my scatter plot belong to two categories: apple and oranges. However, there are different kinds of these fruits. Therefore, I would like to classify them based on their kinds in the legend. In practice, the items on the legend should be similar to the one above. Filled and not filled markers to distinguish the kind of fruits. In the bottom of the legend, something similar to "Single-channel" and "Time-interleaving" above to put the names of the kinds. Different markers, instead, expresses apple and oranges.
Do you have any idea if this is possible in matlab ?
Thank you in advance ! legend, scatter plot MATLAB Answers — New Questions
copying a simulink library block without its link
Hi,
I have a created a subsystem through s-function with variable number of inports. I want to use this library block at many places in my model assigning separate numbers of Inports. Problem comes when i close the model and open it again, at all the places i have same number of inports which is defined in library block, so I have to manually assign number of inports at all the place before running the simulation.
I have overcome with this problem by disabling the link for each block with its library block. I am wondering is there any way by which I can assign a property to my library block so that whenever someone copies this block in his simulink model, it will disable its link automatically instead of doing it manually everytime?
Thanks,Hi,
I have a created a subsystem through s-function with variable number of inports. I want to use this library block at many places in my model assigning separate numbers of Inports. Problem comes when i close the model and open it again, at all the places i have same number of inports which is defined in library block, so I have to manually assign number of inports at all the place before running the simulation.
I have overcome with this problem by disabling the link for each block with its library block. I am wondering is there any way by which I can assign a property to my library block so that whenever someone copies this block in his simulink model, it will disable its link automatically instead of doing it manually everytime?
Thanks, Hi,
I have a created a subsystem through s-function with variable number of inports. I want to use this library block at many places in my model assigning separate numbers of Inports. Problem comes when i close the model and open it again, at all the places i have same number of inports which is defined in library block, so I have to manually assign number of inports at all the place before running the simulation.
I have overcome with this problem by disabling the link for each block with its library block. I am wondering is there any way by which I can assign a property to my library block so that whenever someone copies this block in his simulink model, it will disable its link automatically instead of doing it manually everytime?
Thanks, subsystem, library MATLAB Answers — New Questions
d solve command matlab
hello i just started programmig with matlab and encountered this error :
Error using symengine (line 58)
Could not extract differential variables to solve for. Use ‘solve’ or ‘vpasolve’ to compute the solutions of
non-differential equations.
Error in mupadengine/feval (line 155)
symengine(‘error’,S(8:find(S=='[‘,1)-2));
Error in dsolve>mupadDsolve (line 328)
T = feval(symengine,’symobj::dsolve’,sys,x,options);
Error in dsolve (line 189)
sol = mupadDsolve(args, options);
Error in hwbrownwk202016 (line 6)
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
this is the program
clear all
syms e P S A t m V0 t0 V(t) real
IC = V(0)==V0
diffeq = diff(V(t),t) == P + e*V(t) – m*(S-(V(t)))
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
the program work in the online version but not in 2013…anybody knows wat the problem is?hello i just started programmig with matlab and encountered this error :
Error using symengine (line 58)
Could not extract differential variables to solve for. Use ‘solve’ or ‘vpasolve’ to compute the solutions of
non-differential equations.
Error in mupadengine/feval (line 155)
symengine(‘error’,S(8:find(S=='[‘,1)-2));
Error in dsolve>mupadDsolve (line 328)
T = feval(symengine,’symobj::dsolve’,sys,x,options);
Error in dsolve (line 189)
sol = mupadDsolve(args, options);
Error in hwbrownwk202016 (line 6)
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
this is the program
clear all
syms e P S A t m V0 t0 V(t) real
IC = V(0)==V0
diffeq = diff(V(t),t) == P + e*V(t) – m*(S-(V(t)))
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
the program work in the online version but not in 2013…anybody knows wat the problem is? hello i just started programmig with matlab and encountered this error :
Error using symengine (line 58)
Could not extract differential variables to solve for. Use ‘solve’ or ‘vpasolve’ to compute the solutions of
non-differential equations.
Error in mupadengine/feval (line 155)
symengine(‘error’,S(8:find(S=='[‘,1)-2));
Error in dsolve>mupadDsolve (line 328)
T = feval(symengine,’symobj::dsolve’,sys,x,options);
Error in dsolve (line 189)
sol = mupadDsolve(args, options);
Error in hwbrownwk202016 (line 6)
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
this is the program
clear all
syms e P S A t m V0 t0 V(t) real
IC = V(0)==V0
diffeq = diff(V(t),t) == P + e*V(t) – m*(S-(V(t)))
solve = simplify(dsolve([diffeq,IC],symvar(V(t))))
the program work in the online version but not in 2013…anybody knows wat the problem is? dsolve command r2013 MATLAB Answers — New Questions
How to use pointAt() to point ground stations gimbals at different satellites at different time in satellite constellation to study link margin?
I’m trying to study link budget of ground stations and satellite constellation.
I’ve gone through the exapmle "https://in.mathworks.com/help/satcom/ug/multihop-satellite-communication.html". This example shows one ground station (GS1) pointing at one satellite (sat1) and another ground station (GS2) at another satellite (sat2), and then calculating link margin from GS1 to GS2.
Im trying to extend this example by using satellite constellation where a ground station can use the presently visible satellite and switch to next one after the crossing of the satellite.
I’ve tried it using the below code
sc = satelliteScenario(startTime, stopTime, sampleTime, ‘AutoSimulate’,true);
plotRaditationPattern = true;
% Add ground stations
gsMumbai = groundStation(sc, ‘Name’, ‘BOM GS’, ‘Latitude’, 19.0760, ‘Longitude’, 72.8777); % Mumbai Ground Station
ueBengaluru = groundStation(sc, ‘Name’, ‘BLR UE’, ‘Latitude’, 12.9716, ‘Longitude’, 77.5946); % User Equipment in Bengaluru
% Add LEO satellite constellation (Keplerian elements)
numSatellites = 40;
semiMajorAxis = 7000e3 * ones(1, numSatellites); % Approximate altitude for LEO
eccentricity = zeros(1, numSatellites);
argumentOfPeriapsis = 13*ones(1, numSatellites);
trueAnomaly = linspace(0, 360, numSatellites); % Distribute satellites around the orbit
inclination = 40 * ones(1, numSatellites); % Common inclination for constellations
rightAscensionOfAscendingNode = linspace(0, 360, numSatellites);
[accessIntervalsGS2GS, acessGS2GS] = getSource2TargetPaths(gsMumbai, ueBengaluru, satArray, 1,false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hop:’);
disp(accessIntervalsGS2GS);
sc.AutoSimulate = false;
restart(sc);
disp(sc.SimulationStatus)
% Iterate over the simulation time and dynamically point the gimbal at the correct satellite
while sc.SimulationTime <= sc.StopTime
currentSimTime = sc.SimulationTime; % Get the current simulation time
% Check the access intervals to find the satellite that is visible at this time
for i = 1:height(accessIntervalsGS2GS)
% Get the access interval start and end times
intervalStart = accessIntervalsGS2GS(i, 4);
intervalEnd = accessIntervalsGS2GS(i, 5);
% If the current simulation time is within the access interval
if currentSimTime >= intervalStart.Variables && currentSimTime <= intervalEnd.Variables
% Get the satellite associated with this access interval using acessGS2GS
satID = acessGS2GS(i).Sequence(2); % Source asset ID (Satellite ID)
% Find the corresponding satellite object in satArray using the ID
for j = 1:numel(satArray)
if satArray(j).ID == satID
% Point the gimbal at the satellite
pointAt(gimbalGSMumbaitx, satArray(j));
pointAt(gimbalUErx, satArray(j));
break; % Stop after pointing at the correct satellite
end
end
end
end
% Update the simulation time step
if (sc.SimulationStatus ~= "Completed") && (seconds(sc.StopTime – sc.SimulationTime) > sc.SampleTime)
disp(sc.SimulationTime)
advance(sc);
else
break;
end
end
% restart(sc);
sc.AutoSimulate = true;
[linksIntervalsGS2GS, linksGS2GS] = getSource2TargetPathLinks(gsMumbai, ueBengaluru, satArray, 1, false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hops:’);
disp(linksIntervalsGS2GS);
However the pointAt() function causes the ground stations to point only at the last satellite, so for whole simulation they are pointing at only 1 satellite.
How to dynamically point ground stations to the passing satellites at different times of the simulations.?
This should give us link margin between the two ground stations all the time whenver a satellite connects to both the ground stations.I’m trying to study link budget of ground stations and satellite constellation.
I’ve gone through the exapmle "https://in.mathworks.com/help/satcom/ug/multihop-satellite-communication.html". This example shows one ground station (GS1) pointing at one satellite (sat1) and another ground station (GS2) at another satellite (sat2), and then calculating link margin from GS1 to GS2.
Im trying to extend this example by using satellite constellation where a ground station can use the presently visible satellite and switch to next one after the crossing of the satellite.
I’ve tried it using the below code
sc = satelliteScenario(startTime, stopTime, sampleTime, ‘AutoSimulate’,true);
plotRaditationPattern = true;
% Add ground stations
gsMumbai = groundStation(sc, ‘Name’, ‘BOM GS’, ‘Latitude’, 19.0760, ‘Longitude’, 72.8777); % Mumbai Ground Station
ueBengaluru = groundStation(sc, ‘Name’, ‘BLR UE’, ‘Latitude’, 12.9716, ‘Longitude’, 77.5946); % User Equipment in Bengaluru
% Add LEO satellite constellation (Keplerian elements)
numSatellites = 40;
semiMajorAxis = 7000e3 * ones(1, numSatellites); % Approximate altitude for LEO
eccentricity = zeros(1, numSatellites);
argumentOfPeriapsis = 13*ones(1, numSatellites);
trueAnomaly = linspace(0, 360, numSatellites); % Distribute satellites around the orbit
inclination = 40 * ones(1, numSatellites); % Common inclination for constellations
rightAscensionOfAscendingNode = linspace(0, 360, numSatellites);
[accessIntervalsGS2GS, acessGS2GS] = getSource2TargetPaths(gsMumbai, ueBengaluru, satArray, 1,false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hop:’);
disp(accessIntervalsGS2GS);
sc.AutoSimulate = false;
restart(sc);
disp(sc.SimulationStatus)
% Iterate over the simulation time and dynamically point the gimbal at the correct satellite
while sc.SimulationTime <= sc.StopTime
currentSimTime = sc.SimulationTime; % Get the current simulation time
% Check the access intervals to find the satellite that is visible at this time
for i = 1:height(accessIntervalsGS2GS)
% Get the access interval start and end times
intervalStart = accessIntervalsGS2GS(i, 4);
intervalEnd = accessIntervalsGS2GS(i, 5);
% If the current simulation time is within the access interval
if currentSimTime >= intervalStart.Variables && currentSimTime <= intervalEnd.Variables
% Get the satellite associated with this access interval using acessGS2GS
satID = acessGS2GS(i).Sequence(2); % Source asset ID (Satellite ID)
% Find the corresponding satellite object in satArray using the ID
for j = 1:numel(satArray)
if satArray(j).ID == satID
% Point the gimbal at the satellite
pointAt(gimbalGSMumbaitx, satArray(j));
pointAt(gimbalUErx, satArray(j));
break; % Stop after pointing at the correct satellite
end
end
end
end
% Update the simulation time step
if (sc.SimulationStatus ~= "Completed") && (seconds(sc.StopTime – sc.SimulationTime) > sc.SampleTime)
disp(sc.SimulationTime)
advance(sc);
else
break;
end
end
% restart(sc);
sc.AutoSimulate = true;
[linksIntervalsGS2GS, linksGS2GS] = getSource2TargetPathLinks(gsMumbai, ueBengaluru, satArray, 1, false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hops:’);
disp(linksIntervalsGS2GS);
However the pointAt() function causes the ground stations to point only at the last satellite, so for whole simulation they are pointing at only 1 satellite.
How to dynamically point ground stations to the passing satellites at different times of the simulations.?
This should give us link margin between the two ground stations all the time whenver a satellite connects to both the ground stations. I’m trying to study link budget of ground stations and satellite constellation.
I’ve gone through the exapmle "https://in.mathworks.com/help/satcom/ug/multihop-satellite-communication.html". This example shows one ground station (GS1) pointing at one satellite (sat1) and another ground station (GS2) at another satellite (sat2), and then calculating link margin from GS1 to GS2.
Im trying to extend this example by using satellite constellation where a ground station can use the presently visible satellite and switch to next one after the crossing of the satellite.
I’ve tried it using the below code
sc = satelliteScenario(startTime, stopTime, sampleTime, ‘AutoSimulate’,true);
plotRaditationPattern = true;
% Add ground stations
gsMumbai = groundStation(sc, ‘Name’, ‘BOM GS’, ‘Latitude’, 19.0760, ‘Longitude’, 72.8777); % Mumbai Ground Station
ueBengaluru = groundStation(sc, ‘Name’, ‘BLR UE’, ‘Latitude’, 12.9716, ‘Longitude’, 77.5946); % User Equipment in Bengaluru
% Add LEO satellite constellation (Keplerian elements)
numSatellites = 40;
semiMajorAxis = 7000e3 * ones(1, numSatellites); % Approximate altitude for LEO
eccentricity = zeros(1, numSatellites);
argumentOfPeriapsis = 13*ones(1, numSatellites);
trueAnomaly = linspace(0, 360, numSatellites); % Distribute satellites around the orbit
inclination = 40 * ones(1, numSatellites); % Common inclination for constellations
rightAscensionOfAscendingNode = linspace(0, 360, numSatellites);
[accessIntervalsGS2GS, acessGS2GS] = getSource2TargetPaths(gsMumbai, ueBengaluru, satArray, 1,false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hop:’);
disp(accessIntervalsGS2GS);
sc.AutoSimulate = false;
restart(sc);
disp(sc.SimulationStatus)
% Iterate over the simulation time and dynamically point the gimbal at the correct satellite
while sc.SimulationTime <= sc.StopTime
currentSimTime = sc.SimulationTime; % Get the current simulation time
% Check the access intervals to find the satellite that is visible at this time
for i = 1:height(accessIntervalsGS2GS)
% Get the access interval start and end times
intervalStart = accessIntervalsGS2GS(i, 4);
intervalEnd = accessIntervalsGS2GS(i, 5);
% If the current simulation time is within the access interval
if currentSimTime >= intervalStart.Variables && currentSimTime <= intervalEnd.Variables
% Get the satellite associated with this access interval using acessGS2GS
satID = acessGS2GS(i).Sequence(2); % Source asset ID (Satellite ID)
% Find the corresponding satellite object in satArray using the ID
for j = 1:numel(satArray)
if satArray(j).ID == satID
% Point the gimbal at the satellite
pointAt(gimbalGSMumbaitx, satArray(j));
pointAt(gimbalUErx, satArray(j));
break; % Stop after pointing at the correct satellite
end
end
end
end
% Update the simulation time step
if (sc.SimulationStatus ~= "Completed") && (seconds(sc.StopTime – sc.SimulationTime) > sc.SampleTime)
disp(sc.SimulationTime)
advance(sc);
else
break;
end
end
% restart(sc);
sc.AutoSimulate = true;
[linksIntervalsGS2GS, linksGS2GS] = getSource2TargetPathLinks(gsMumbai, ueBengaluru, satArray, 1, false);
disp(‘Ground station to Ground Station Access Intervals with max 1 hops:’);
disp(linksIntervalsGS2GS);
However the pointAt() function causes the ground stations to point only at the last satellite, so for whole simulation they are pointing at only 1 satellite.
How to dynamically point ground stations to the passing satellites at different times of the simulations.?
This should give us link margin between the two ground stations all the time whenver a satellite connects to both the ground stations. satellite communication, link margin, pointat MATLAB Answers — New Questions
problem about function “evalclusters” function for gap statistic
%% This is an exampler for Clustering evaluation based on gap statistic
YYc=rand(1,100);
evaluation = evalclusters(YYc,"kmeans","gap","KList",2:10,’SearchMethod’,’globalMaxSE’,’B’,40);%% ‘SearchMethod’ — Method for selecting optimal number of clusters, ‘globalMaxSE’ (default) | ‘firstMaxSE’
I find that almost all references take "firstMaxSE" as the serach method . There is little literature being based on "globalMaxSE" . I want to know why the programmer design "’globalMaxSE", and how to find the reference.%% This is an exampler for Clustering evaluation based on gap statistic
YYc=rand(1,100);
evaluation = evalclusters(YYc,"kmeans","gap","KList",2:10,’SearchMethod’,’globalMaxSE’,’B’,40);%% ‘SearchMethod’ — Method for selecting optimal number of clusters, ‘globalMaxSE’ (default) | ‘firstMaxSE’
I find that almost all references take "firstMaxSE" as the serach method . There is little literature being based on "globalMaxSE" . I want to know why the programmer design "’globalMaxSE", and how to find the reference. %% This is an exampler for Clustering evaluation based on gap statistic
YYc=rand(1,100);
evaluation = evalclusters(YYc,"kmeans","gap","KList",2:10,’SearchMethod’,’globalMaxSE’,’B’,40);%% ‘SearchMethod’ — Method for selecting optimal number of clusters, ‘globalMaxSE’ (default) | ‘firstMaxSE’
I find that almost all references take "firstMaxSE" as the serach method . There is little literature being based on "globalMaxSE" . I want to know why the programmer design "’globalMaxSE", and how to find the reference. gap statistic, gapevaluation MATLAB Answers — New Questions
Slowness in mathworks container
My team is running matlab simulink simulations in a containerized environment using the matlab CI token. We are seeing a slowdown in performance in our containerized environment relative to bare metal–regardless of whether we run on mac silicon or windows x86. Are there any "gotchas" we should be aware of that would cause matlab to perform worse in the container than it does on a bare metal machine?My team is running matlab simulink simulations in a containerized environment using the matlab CI token. We are seeing a slowdown in performance in our containerized environment relative to bare metal–regardless of whether we run on mac silicon or windows x86. Are there any "gotchas" we should be aware of that would cause matlab to perform worse in the container than it does on a bare metal machine? My team is running matlab simulink simulations in a containerized environment using the matlab CI token. We are seeing a slowdown in performance in our containerized environment relative to bare metal–regardless of whether we run on mac silicon or windows x86. Are there any "gotchas" we should be aware of that would cause matlab to perform worse in the container than it does on a bare metal machine? docker MATLAB Answers — New Questions
How to write ASCII to byte file?
In MATLB versions until R2021a I could write ASCII values stored in a CHAR array into a string as unsigned char by:
data = char([126, 129]); % Exceeds 7 bit ASCII
file = fullfile(tempdir, ‘test.dat’);
[fid, msg] = fopen(file, ‘w’);
assert(fid ~= -1, msg);
fwrite(fid, data); % Write uchar until R2021b
fclose(fid);
This wrote the unsigned chars [126, 129] untill R2021b:
[fid, msg] = fopen(file, ‘r’);
bytes = fread(fid, [1, inf], ‘uint8’); % < R2021b: [126, 129]
Since R2021b the bytes are converted to UTF-8 and the file contains [126, 194, 129], so a specification is required:
fwrite(fid, data, ‘uchar’); % < R2024b: [126, 129], R2024b: [126, 194, 129]
In R2024b this writes [126, 194, 129] again. Intuitively I’ve tried:
fwrite(fid, data, ‘uint8’); % R2024b: [126, 194, 129] also
Playing with the encoding type in fopen does not help also. My questions:
Is there a low level method to write UCHARs stored in a CHAR vector using fopen / fwrite without a Unicode conversion?
This change of behaviour breaks a lot of my codes. Is this considered to be useful?
What is the best way to write unsigned bytes without dependency to the platform?
A workaround is the casting to UINT8:
fwrite(fid, uint8(data), ‘uint8’);
But duplicating data in memory without a reason is a waste of time.In MATLB versions until R2021a I could write ASCII values stored in a CHAR array into a string as unsigned char by:
data = char([126, 129]); % Exceeds 7 bit ASCII
file = fullfile(tempdir, ‘test.dat’);
[fid, msg] = fopen(file, ‘w’);
assert(fid ~= -1, msg);
fwrite(fid, data); % Write uchar until R2021b
fclose(fid);
This wrote the unsigned chars [126, 129] untill R2021b:
[fid, msg] = fopen(file, ‘r’);
bytes = fread(fid, [1, inf], ‘uint8’); % < R2021b: [126, 129]
Since R2021b the bytes are converted to UTF-8 and the file contains [126, 194, 129], so a specification is required:
fwrite(fid, data, ‘uchar’); % < R2024b: [126, 129], R2024b: [126, 194, 129]
In R2024b this writes [126, 194, 129] again. Intuitively I’ve tried:
fwrite(fid, data, ‘uint8’); % R2024b: [126, 194, 129] also
Playing with the encoding type in fopen does not help also. My questions:
Is there a low level method to write UCHARs stored in a CHAR vector using fopen / fwrite without a Unicode conversion?
This change of behaviour breaks a lot of my codes. Is this considered to be useful?
What is the best way to write unsigned bytes without dependency to the platform?
A workaround is the casting to UINT8:
fwrite(fid, uint8(data), ‘uint8’);
But duplicating data in memory without a reason is a waste of time. In MATLB versions until R2021a I could write ASCII values stored in a CHAR array into a string as unsigned char by:
data = char([126, 129]); % Exceeds 7 bit ASCII
file = fullfile(tempdir, ‘test.dat’);
[fid, msg] = fopen(file, ‘w’);
assert(fid ~= -1, msg);
fwrite(fid, data); % Write uchar until R2021b
fclose(fid);
This wrote the unsigned chars [126, 129] untill R2021b:
[fid, msg] = fopen(file, ‘r’);
bytes = fread(fid, [1, inf], ‘uint8’); % < R2021b: [126, 129]
Since R2021b the bytes are converted to UTF-8 and the file contains [126, 194, 129], so a specification is required:
fwrite(fid, data, ‘uchar’); % < R2024b: [126, 129], R2024b: [126, 194, 129]
In R2024b this writes [126, 194, 129] again. Intuitively I’ve tried:
fwrite(fid, data, ‘uint8’); % R2024b: [126, 194, 129] also
Playing with the encoding type in fopen does not help also. My questions:
Is there a low level method to write UCHARs stored in a CHAR vector using fopen / fwrite without a Unicode conversion?
This change of behaviour breaks a lot of my codes. Is this considered to be useful?
What is the best way to write unsigned bytes without dependency to the platform?
A workaround is the casting to UINT8:
fwrite(fid, uint8(data), ‘uint8’);
But duplicating data in memory without a reason is a waste of time. ascii, uchar, fwrite, fopen, unicode MATLAB Answers — New Questions
Why do I receive “MATLAB: binder.loadFailure; LAPACK load error”
The program written by App Designer has no error when running in MATLAB; Compile it, and at run time "MATLAB: binder.loadFailure; LAPACK load error"The program written by App Designer has no error when running in MATLAB; Compile it, and at run time "MATLAB: binder.loadFailure; LAPACK load error" The program written by App Designer has no error when running in MATLAB; Compile it, and at run time "MATLAB: binder.loadFailure; LAPACK load error" app designer MATLAB Answers — New Questions
Simulation 3D of Simulink 3D animation is working in real-time?
Hello everyone,
I’m currently working on a project in Simulink where I need to control 3D objects in real-time. These objects are connected to controllers like a mouse or a robot. For instance, I have a cursor that moves based on mouse input, and its position changes continuously.
I have been using Simulink Desktop Real-Time (SLDRT) to achieve the real-time performance required for my project. However, I’ve learned that in upcoming versions of MATLAB, the Virtual Reality (VR) Sink blocks used for 3D visualization will be removed. The MATLAB documentation suggests using Simulation 3D blocks (like Simulation 3D Scene Configuration, Simulation 3D Actor, etc.) as replacements.
I attempted to implement these Simulation 3D blocks, but I’ve run into several limitations, which are also detailed Unreal Engine Simulation Environment Requirements and Limitations – MATLAB & Simulink – MathWorks Italia. The main issue is that the Simulation 3D blocks do not support SLDRT. When I try to run my model, I receive the following error: "The selected system target file ‘sldrt.tlc’ is not currently supported for concurrent execution."
My question is: How can I achieve real-time 3D visualization in Simulink, given that the VR Sink blocks are being deprecated and the Simulation 3D blocks don’t support SLDRT? Are there alternative methods or tools that I can use to visualize my 3D models in real-time while still using SLDRT?
Any advice or suggestions would be greatly appreciated!
Thank you.Hello everyone,
I’m currently working on a project in Simulink where I need to control 3D objects in real-time. These objects are connected to controllers like a mouse or a robot. For instance, I have a cursor that moves based on mouse input, and its position changes continuously.
I have been using Simulink Desktop Real-Time (SLDRT) to achieve the real-time performance required for my project. However, I’ve learned that in upcoming versions of MATLAB, the Virtual Reality (VR) Sink blocks used for 3D visualization will be removed. The MATLAB documentation suggests using Simulation 3D blocks (like Simulation 3D Scene Configuration, Simulation 3D Actor, etc.) as replacements.
I attempted to implement these Simulation 3D blocks, but I’ve run into several limitations, which are also detailed Unreal Engine Simulation Environment Requirements and Limitations – MATLAB & Simulink – MathWorks Italia. The main issue is that the Simulation 3D blocks do not support SLDRT. When I try to run my model, I receive the following error: "The selected system target file ‘sldrt.tlc’ is not currently supported for concurrent execution."
My question is: How can I achieve real-time 3D visualization in Simulink, given that the VR Sink blocks are being deprecated and the Simulation 3D blocks don’t support SLDRT? Are there alternative methods or tools that I can use to visualize my 3D models in real-time while still using SLDRT?
Any advice or suggestions would be greatly appreciated!
Thank you. Hello everyone,
I’m currently working on a project in Simulink where I need to control 3D objects in real-time. These objects are connected to controllers like a mouse or a robot. For instance, I have a cursor that moves based on mouse input, and its position changes continuously.
I have been using Simulink Desktop Real-Time (SLDRT) to achieve the real-time performance required for my project. However, I’ve learned that in upcoming versions of MATLAB, the Virtual Reality (VR) Sink blocks used for 3D visualization will be removed. The MATLAB documentation suggests using Simulation 3D blocks (like Simulation 3D Scene Configuration, Simulation 3D Actor, etc.) as replacements.
I attempted to implement these Simulation 3D blocks, but I’ve run into several limitations, which are also detailed Unreal Engine Simulation Environment Requirements and Limitations – MATLAB & Simulink – MathWorks Italia. The main issue is that the Simulation 3D blocks do not support SLDRT. When I try to run my model, I receive the following error: "The selected system target file ‘sldrt.tlc’ is not currently supported for concurrent execution."
My question is: How can I achieve real-time 3D visualization in Simulink, given that the VR Sink blocks are being deprecated and the Simulation 3D blocks don’t support SLDRT? Are there alternative methods or tools that I can use to visualize my 3D models in real-time while still using SLDRT?
Any advice or suggestions would be greatly appreciated!
Thank you. matlab, simulink, sldrt, simulation MATLAB Answers — New Questions
Need to generate 600 Hz signal
Hello expert,
I am currently working on a project involving the generation of a 600 Hz signal in a Simulink model.
I am encountering a few challenges that I would appreciate your expertise on:
Symbol Rate: I understand that for Binary Phase Shift Keying (BPSK), the symbol rate is equivalent to the bit rate. To achieve a bandwidth of 600 Hz, I am considering setting the bit rate to 600 bps. Is this the correct approach, or do I need to consider other factors (e.g., filtering effects) that might influence the bandwidth?
Sample Time and Stop Time: I would like guidance on the appropriate sample time and stop time settings for my simulation. Currently, I have set the sample time to 1/600 seconds, which corresponds to one sample per bit. Additionally, for a frame length of 208 bits, I calculated the stop time to be approximately 0.347 seconds to transmit one frame. Is this a correct configuration?
Spectrum Analyzer Placement: I am also unsure about the optimal placement of the Spectrum Analyzer block in my Simulink model. Could you please advise on the best practice for integrating this block to accurately visualize the generated signal’s frequency spectrum?
Below are each block information that I set.
RandomPayloadIP(Matlab Function) : Use for generate the Payload String. (I set sample time to 1/600)
SigfoxdataFrame(Matlab Function) : Use for generate the bitStream from Payload String. (Fix output length , 208)
Constant [10×1] : to add 0 at the tails of bistream.
DBPSK : DBPSK modulation
RRC tx Filter (Roll of Factor = 0.5, Filter Span in Symbol = 10, Output Sample per symbol = 8)
And here is what Spectrum look like.
The signal bandwidth is 165 kHz with SA sample Rate = 1.0464 MHz.
But what I need is just 600 Hz wide signal or very close to 600 Hz. Is it possible?
Thank you for your time and assistance!
Best Regards,
Fumihiko SatoHello expert,
I am currently working on a project involving the generation of a 600 Hz signal in a Simulink model.
I am encountering a few challenges that I would appreciate your expertise on:
Symbol Rate: I understand that for Binary Phase Shift Keying (BPSK), the symbol rate is equivalent to the bit rate. To achieve a bandwidth of 600 Hz, I am considering setting the bit rate to 600 bps. Is this the correct approach, or do I need to consider other factors (e.g., filtering effects) that might influence the bandwidth?
Sample Time and Stop Time: I would like guidance on the appropriate sample time and stop time settings for my simulation. Currently, I have set the sample time to 1/600 seconds, which corresponds to one sample per bit. Additionally, for a frame length of 208 bits, I calculated the stop time to be approximately 0.347 seconds to transmit one frame. Is this a correct configuration?
Spectrum Analyzer Placement: I am also unsure about the optimal placement of the Spectrum Analyzer block in my Simulink model. Could you please advise on the best practice for integrating this block to accurately visualize the generated signal’s frequency spectrum?
Below are each block information that I set.
RandomPayloadIP(Matlab Function) : Use for generate the Payload String. (I set sample time to 1/600)
SigfoxdataFrame(Matlab Function) : Use for generate the bitStream from Payload String. (Fix output length , 208)
Constant [10×1] : to add 0 at the tails of bistream.
DBPSK : DBPSK modulation
RRC tx Filter (Roll of Factor = 0.5, Filter Span in Symbol = 10, Output Sample per symbol = 8)
And here is what Spectrum look like.
The signal bandwidth is 165 kHz with SA sample Rate = 1.0464 MHz.
But what I need is just 600 Hz wide signal or very close to 600 Hz. Is it possible?
Thank you for your time and assistance!
Best Regards,
Fumihiko Sato Hello expert,
I am currently working on a project involving the generation of a 600 Hz signal in a Simulink model.
I am encountering a few challenges that I would appreciate your expertise on:
Symbol Rate: I understand that for Binary Phase Shift Keying (BPSK), the symbol rate is equivalent to the bit rate. To achieve a bandwidth of 600 Hz, I am considering setting the bit rate to 600 bps. Is this the correct approach, or do I need to consider other factors (e.g., filtering effects) that might influence the bandwidth?
Sample Time and Stop Time: I would like guidance on the appropriate sample time and stop time settings for my simulation. Currently, I have set the sample time to 1/600 seconds, which corresponds to one sample per bit. Additionally, for a frame length of 208 bits, I calculated the stop time to be approximately 0.347 seconds to transmit one frame. Is this a correct configuration?
Spectrum Analyzer Placement: I am also unsure about the optimal placement of the Spectrum Analyzer block in my Simulink model. Could you please advise on the best practice for integrating this block to accurately visualize the generated signal’s frequency spectrum?
Below are each block information that I set.
RandomPayloadIP(Matlab Function) : Use for generate the Payload String. (I set sample time to 1/600)
SigfoxdataFrame(Matlab Function) : Use for generate the bitStream from Payload String. (Fix output length , 208)
Constant [10×1] : to add 0 at the tails of bistream.
DBPSK : DBPSK modulation
RRC tx Filter (Roll of Factor = 0.5, Filter Span in Symbol = 10, Output Sample per symbol = 8)
And here is what Spectrum look like.
The signal bandwidth is 165 kHz with SA sample Rate = 1.0464 MHz.
But what I need is just 600 Hz wide signal or very close to 600 Hz. Is it possible?
Thank you for your time and assistance!
Best Regards,
Fumihiko Sato wireless communication MATLAB Answers — New Questions
Is possible to show my custom app in Simulink APPS tab
Hi all!
I am currently working on an extension app for Embedded coder and my idea is to create custom tab in Simulink toolstrip. I have used this tutorial for that. Then I have successfully packed the app using "Package App" tool and everything works quite good, problem is that the my installed app shows only in Matlab’s APPS tab. Is there any possible workaround how to set application as visible in Simulink like Embedded Coder app does?
Side question to this is if there is possibility to create app directly for simulink the way how all the apps in Simulink APPS tab works? You pick the app from the toolstrip tab and new closeable tab will open. Because even if the way described in tutorial mentioned above works, it is little bit hacky.
Thanks in advance for any answer. :)Hi all!
I am currently working on an extension app for Embedded coder and my idea is to create custom tab in Simulink toolstrip. I have used this tutorial for that. Then I have successfully packed the app using "Package App" tool and everything works quite good, problem is that the my installed app shows only in Matlab’s APPS tab. Is there any possible workaround how to set application as visible in Simulink like Embedded Coder app does?
Side question to this is if there is possibility to create app directly for simulink the way how all the apps in Simulink APPS tab works? You pick the app from the toolstrip tab and new closeable tab will open. Because even if the way described in tutorial mentioned above works, it is little bit hacky.
Thanks in advance for any answer. 🙂 Hi all!
I am currently working on an extension app for Embedded coder and my idea is to create custom tab in Simulink toolstrip. I have used this tutorial for that. Then I have successfully packed the app using "Package App" tool and everything works quite good, problem is that the my installed app shows only in Matlab’s APPS tab. Is there any possible workaround how to set application as visible in Simulink like Embedded Coder app does?
Side question to this is if there is possibility to create app directly for simulink the way how all the apps in Simulink APPS tab works? You pick the app from the toolstrip tab and new closeable tab will open. Because even if the way described in tutorial mentioned above works, it is little bit hacky.
Thanks in advance for any answer. 🙂 simulink, custom tab, custom simulink app, custom app MATLAB Answers — New Questions
GUI freezes after deleting a Tab
I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible.I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible. I’ve got 6 Tabs in GUI, but one is hidden in the startup fcn. Hidden tab called "Hybrid" is used when user wants to change the engine from Solid one to Hybrid – if so, the Solid one is hidden and the Hybrid appears.
Problem description: I’m using the Browse button (e.g. in Solid tab) right when I start the GUI, and it works – file is imported to GUI, and the Label shows the title of the file. But when I change from Solid to Hybrid and then from Hybrid to Solid again, this button does not work – browse pop up is shown, I choose the file, but then there’s no title in the Label, the whole app designer does not respond (+ there is an error sound wherever I click with my mouse, but no errors in the command window).
To hide tabs I’ve used one of the solutions in Matlab Answer which was to add 2 lines in startupfcn:
app.tg = matlab.ui.container.TabGroup;
app.TabGroup.Children(2).Parent = app.tg;
app.iteration=1;
User can switch between the tabs using both:
1) 2 buttons, "SolidToHybrid", "HybridToSolid" – and their callback:
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
2) 2 Switches with the same callback:
if mod(app.iteration, 2) == 0
value = app.Switch.Value;
else
value = app.Switch_2.Value;
end
app.iteration=app.iteration+1;
if strcmp(value,’Hybrid’)
app.Switch.Value="Hybrid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
else
app.Switch_2.Value="Solid";
app.tg.Children(1).Parent = app.TabGroup;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(3).Parent = app.tg;
app.TabGroup.Children(2).Parent = app.tg;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
app.tg.Children(1).Parent = app.TabGroup;
end
this "deletes" all tabs that are to the right and adding the chosen one + the deleted rest in the correct order.
The order of tabs: "First", "Solid", ("Hybrid"), "Fourth", "Fifth", "Sixth"
I’ve chosen 2 options to eliminate e.g. infinite loops connected with switch (I thought it could be a problem), but it seems like there’s a different problem since in both cases "Browsing files" does not work.
Edit: Maybe there’s a different, easier way to hide Tabs but with the similar outcome – always only one is visible. gui, app designer MATLAB Answers — New Questions
Remote address for Simulink TCP/IP block as parameter/variable from workspace?
Hi,
The parameters/variables for other blocks are set with a m-file with a callback when opening the Simulink model. The TCP/IP block seem to treat the "remote address" as IP or URL. Is it possible to set the remote address for a TCP/IP block in Simulink with a variable from workspace?
Thanks.
regards
W. HolzkeHi,
The parameters/variables for other blocks are set with a m-file with a callback when opening the Simulink model. The TCP/IP block seem to treat the "remote address" as IP or URL. Is it possible to set the remote address for a TCP/IP block in Simulink with a variable from workspace?
Thanks.
regards
W. Holzke Hi,
The parameters/variables for other blocks are set with a m-file with a callback when opening the Simulink model. The TCP/IP block seem to treat the "remote address" as IP or URL. Is it possible to set the remote address for a TCP/IP block in Simulink with a variable from workspace?
Thanks.
regards
W. Holzke simulink, tcp/ip MATLAB Answers — New Questions
Why do I encounter that “rtw.connectivity.HostLauncher: stopped executable with host process identifier xx” when attempting to deploy the Simulink model on hardware?
Hi,
I am trying to use Simulink external mode and deploy Simulink models on hardware. The model is compiled successfully, and I get a host process identifier after deployment. But suddenly terminated after a few seconds (without any action taken)
There are no error prompts either. How could I confirm which step went wrong?
ThanksHi,
I am trying to use Simulink external mode and deploy Simulink models on hardware. The model is compiled successfully, and I get a host process identifier after deployment. But suddenly terminated after a few seconds (without any action taken)
There are no error prompts either. How could I confirm which step went wrong?
Thanks Hi,
I am trying to use Simulink external mode and deploy Simulink models on hardware. The model is compiled successfully, and I get a host process identifier after deployment. But suddenly terminated after a few seconds (without any action taken)
There are no error prompts either. How could I confirm which step went wrong?
Thanks simulink, external mode, rtw.connectivity.hostlauncher, deployment MATLAB Answers — New Questions
How to convert a struct to an object?
I am having a Gaussian mixture model data in the form of struct with all the parameters identical to that of the GMM object. How to convert this struct to object?I am having a Gaussian mixture model data in the form of struct with all the parameters identical to that of the GMM object. How to convert this struct to object? I am having a Gaussian mixture model data in the form of struct with all the parameters identical to that of the GMM object. How to convert this struct to object? structures, objects, gmm, gaussian, casting, oop MATLAB Answers — New Questions
Using the installer returns std::runtime_error (Linux Mint 22)
I get the following error message when running the installer:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 262
This thread reports the same error and suggests to install libXss1 and libgconf-2-4, but it didn’t help.
Thanks for your helpI get the following error message when running the installer:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 262
This thread reports the same error and suggests to install libXss1 and libgconf-2-4, but it didn’t help.
Thanks for your help I get the following error message when running the installer:
terminate called after throwing an instance of ‘std::runtime_error’
what(): Failed to launch web window with error: Unable to launch the MATLABWindow application. The exit code was: 262
This thread reports the same error and suggests to install libXss1 and libgconf-2-4, but it didn’t help.
Thanks for your help installation, ubuntu MATLAB Answers — New Questions
How to create custom Closed Loop Margin based on the Complementary Sensitivity Function in Systune TuningGoal?
I want to have a hard constraint for my system that puts a constraint on the dynamic margin (generalized delay margin) of the entire system. Mathemathically, the constraint is formulated as follows.
(1)
Where is the complementary sensitivity function of the systems input. I have a similar hard constraint on the sensitivity function:
(2)
And this should be implemented by using TuningGoal.LoopShape as follows.
Hardreq2 = TuningGoal.LoopShape("u",1/0.5,1)
The problem with the first requirement I think is the additional term in the norm. I do not know how to set up this constraint properly. Can anyone help me out?I want to have a hard constraint for my system that puts a constraint on the dynamic margin (generalized delay margin) of the entire system. Mathemathically, the constraint is formulated as follows.
(1)
Where is the complementary sensitivity function of the systems input. I have a similar hard constraint on the sensitivity function:
(2)
And this should be implemented by using TuningGoal.LoopShape as follows.
Hardreq2 = TuningGoal.LoopShape("u",1/0.5,1)
The problem with the first requirement I think is the additional term in the norm. I do not know how to set up this constraint properly. Can anyone help me out? I want to have a hard constraint for my system that puts a constraint on the dynamic margin (generalized delay margin) of the entire system. Mathemathically, the constraint is formulated as follows.
(1)
Where is the complementary sensitivity function of the systems input. I have a similar hard constraint on the sensitivity function:
(2)
And this should be implemented by using TuningGoal.LoopShape as follows.
Hardreq2 = TuningGoal.LoopShape("u",1/0.5,1)
The problem with the first requirement I think is the additional term in the norm. I do not know how to set up this constraint properly. Can anyone help me out? tuninggoal, tuninggoal.loopshape, systune, matlab, sltuner MATLAB Answers — New Questions
How to change nrDLCarrierConfig to FR2?
Just trying to play around with the code here, I am trying to added in parameters to get FR2 instead of FR1 but it isnt working. I know I need to change SCS but I seem to be doing it wrong:
scs1 = nrSCSCarrierConfig;
scs2 = nrSCSCarrierConfig(‘SubcarrierSpacing’,60,’NSizeGrid’,275);
waveconfig = nrDLCarrierConfig(‘FrequencyRange’,’FR2′,’SCSCarriers’, {scs1,scs2},’ChannelBandwidth’,60);
%waveconfig.PDSCH{1}.PRBSet = 0:10;
%waveconfig.ChannelBandwidth = 60;
[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);
% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,’centered’,samplerate,’yaxis’,’MinThreshold’,-130);
title(‘Spectrogram of 5G Downlink Baseband Waveform’);
Is there somewhere with an example? Or can someone please help guide me?Just trying to play around with the code here, I am trying to added in parameters to get FR2 instead of FR1 but it isnt working. I know I need to change SCS but I seem to be doing it wrong:
scs1 = nrSCSCarrierConfig;
scs2 = nrSCSCarrierConfig(‘SubcarrierSpacing’,60,’NSizeGrid’,275);
waveconfig = nrDLCarrierConfig(‘FrequencyRange’,’FR2′,’SCSCarriers’, {scs1,scs2},’ChannelBandwidth’,60);
%waveconfig.PDSCH{1}.PRBSet = 0:10;
%waveconfig.ChannelBandwidth = 60;
[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);
% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,’centered’,samplerate,’yaxis’,’MinThreshold’,-130);
title(‘Spectrogram of 5G Downlink Baseband Waveform’);
Is there somewhere with an example? Or can someone please help guide me? Just trying to play around with the code here, I am trying to added in parameters to get FR2 instead of FR1 but it isnt working. I know I need to change SCS but I seem to be doing it wrong:
scs1 = nrSCSCarrierConfig;
scs2 = nrSCSCarrierConfig(‘SubcarrierSpacing’,60,’NSizeGrid’,275);
waveconfig = nrDLCarrierConfig(‘FrequencyRange’,’FR2′,’SCSCarriers’, {scs1,scs2},’ChannelBandwidth’,60);
%waveconfig.PDSCH{1}.PRBSet = 0:10;
%waveconfig.ChannelBandwidth = 60;
[waveform,waveformInfo] = nrWaveformGenerator(waveconfig);
% Plot spectrogram of waveform for first antenna port
samplerate = waveformInfo.ResourceGrids(1).Info.SampleRate;
nfft = waveformInfo.ResourceGrids(1).Info.Nfft;
figure;
spectrogram(waveform(:,1),ones(nfft,1),0,nfft,’centered’,samplerate,’yaxis’,’MinThreshold’,-130);
title(‘Spectrogram of 5G Downlink Baseband Waveform’);
Is there somewhere with an example? Or can someone please help guide me? #5g, #5gtoolbox, #fr2, #fr1, #nrdlcarrierconfig MATLAB Answers — New Questions