Category: Matlab
Category Archives: Matlab
How to save the figure generated by pcplayer
Hi, I visualize map points estimated by SLAM as a point cloud using the pcplayer. I am wondering if there is a programatic way to save the plot as a video or a figure file. I tried using saveas() function but the object created by pcplayer is different from the figure handle.
For example, suppose I have a steam of 3D point cloud data like below. What would be the best way to save the stream as a video?
player = pcplayer([0 1],[0 1],[0 1]);
while isOpen(player)
ptCloud = pointCloud(rand(1000,3,"single"));
view(player,ptCloud);
endHi, I visualize map points estimated by SLAM as a point cloud using the pcplayer. I am wondering if there is a programatic way to save the plot as a video or a figure file. I tried using saveas() function but the object created by pcplayer is different from the figure handle.
For example, suppose I have a steam of 3D point cloud data like below. What would be the best way to save the stream as a video?
player = pcplayer([0 1],[0 1],[0 1]);
while isOpen(player)
ptCloud = pointCloud(rand(1000,3,"single"));
view(player,ptCloud);
end Hi, I visualize map points estimated by SLAM as a point cloud using the pcplayer. I am wondering if there is a programatic way to save the plot as a video or a figure file. I tried using saveas() function but the object created by pcplayer is different from the figure handle.
For example, suppose I have a steam of 3D point cloud data like below. What would be the best way to save the stream as a video?
player = pcplayer([0 1],[0 1],[0 1]);
while isOpen(player)
ptCloud = pointCloud(rand(1000,3,"single"));
view(player,ptCloud);
end matlab, plotting MATLAB Answers — New Questions
How can I use the pointAt function within the satelliteScenario object to create a sun-pointing satellite?
I am looking to be able to easily create sun-pointing satellites in the satelliteScenario object. I am trying to determine if there is any way to have easily have the pointAt funciton allow me to direct the satellite view towards the sun. Is there any way to access the sun asset within a satelliteScenario object? I have not been able to find any documentation that would indicate that the sun is accessible by the user, yet it is visible and present within the viewer.
Here is an example of the kind of thing I am looking to do:
mission.StartDate = datetime(2024,6,3);
mission.Duration = hours(12);
Rinexdata = rinexread("EXAMPLE_RINEX.rnx");
sc = satelliteScenario(mission.StartDate,mission.StartDate+mission.Duration,60);
sat = satellite(sc,Rinexdata);
Payload = satellite(sc,6878137,0,Inclination,Omega,0,0);
g = gimbal(Payload,"MountingAngles",[0; 0; 0]);
%% I am looking to have this work, so that I can point it at the sun
pointAt(g,SUN)
sensor = conicalSensor(g,MaxViewAngle=179);
fieldOfView(sensor);
access = access(sensor,sat);
viewer3D = satelliteScenarioViewer(sc);
show(access)
hide(sat.Orbit)I am looking to be able to easily create sun-pointing satellites in the satelliteScenario object. I am trying to determine if there is any way to have easily have the pointAt funciton allow me to direct the satellite view towards the sun. Is there any way to access the sun asset within a satelliteScenario object? I have not been able to find any documentation that would indicate that the sun is accessible by the user, yet it is visible and present within the viewer.
Here is an example of the kind of thing I am looking to do:
mission.StartDate = datetime(2024,6,3);
mission.Duration = hours(12);
Rinexdata = rinexread("EXAMPLE_RINEX.rnx");
sc = satelliteScenario(mission.StartDate,mission.StartDate+mission.Duration,60);
sat = satellite(sc,Rinexdata);
Payload = satellite(sc,6878137,0,Inclination,Omega,0,0);
g = gimbal(Payload,"MountingAngles",[0; 0; 0]);
%% I am looking to have this work, so that I can point it at the sun
pointAt(g,SUN)
sensor = conicalSensor(g,MaxViewAngle=179);
fieldOfView(sensor);
access = access(sensor,sat);
viewer3D = satelliteScenarioViewer(sc);
show(access)
hide(sat.Orbit) I am looking to be able to easily create sun-pointing satellites in the satelliteScenario object. I am trying to determine if there is any way to have easily have the pointAt funciton allow me to direct the satellite view towards the sun. Is there any way to access the sun asset within a satelliteScenario object? I have not been able to find any documentation that would indicate that the sun is accessible by the user, yet it is visible and present within the viewer.
Here is an example of the kind of thing I am looking to do:
mission.StartDate = datetime(2024,6,3);
mission.Duration = hours(12);
Rinexdata = rinexread("EXAMPLE_RINEX.rnx");
sc = satelliteScenario(mission.StartDate,mission.StartDate+mission.Duration,60);
sat = satellite(sc,Rinexdata);
Payload = satellite(sc,6878137,0,Inclination,Omega,0,0);
g = gimbal(Payload,"MountingAngles",[0; 0; 0]);
%% I am looking to have this work, so that I can point it at the sun
pointAt(g,SUN)
sensor = conicalSensor(g,MaxViewAngle=179);
fieldOfView(sensor);
access = access(sensor,sat);
viewer3D = satelliteScenarioViewer(sc);
show(access)
hide(sat.Orbit) matlab MATLAB Answers — New Questions
“Arrays have incompatible sizes for this operation” error
As you can see in the attached photo, all of my arrays have the same size (3600 x 3601). So, I don’t understand how I keep getting this error.As you can see in the attached photo, all of my arrays have the same size (3600 x 3601). So, I don’t understand how I keep getting this error. As you can see in the attached photo, all of my arrays have the same size (3600 x 3601). So, I don’t understand how I keep getting this error. error, arrays MATLAB Answers — New Questions
Opening a Figure from a Function – Not enough input arguments
Hello Reader! Basically, I am writing code that opens a figure with a button to be pressed on it, I want this button to open a figure saved in another file (same folder of course) as a function because this will keep the code tidy as a make more buttons/functions. I dont think figures works well on this online version of MATLAB.
Hello here is the function:
% Saved as flow_measurement
function flow_measurement(halfscreensizecentre,figurecolour)
figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider – Flow Measurement’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
end
Hello, here is part of my code:
screensize = get(groot,’ScreenSize’) ;
halfscreensizecentre = [(screensize(1,[3,4])/4),(screensize(1,[3 4]))/2] ;
figurecolour = [230/255 230/255 230/255] ;
figure1 = figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
buttoncolor = [0 64/255 115/255] ;
textcolor = [1 1 1] ;
toprowbuttonheight = 1 – 0.35 ;
toprowtextheight = toprowbuttonheight + 0.21 ;
flowmeasurementbutton = uicontrol(‘Style’,’pushbutton’,’Units’,’normalized’,’Position’,[.125/2,toprowbuttonheight,.25,.25],’BackgroundColor’,buttoncolor …
,’Callback’,@buttonfunction,’UserData’,’1′) ; % Creates a pushbutton
% Callback assigns button press to function following @
% UserData makes an output of 1
textonflowmeasurementbutton = uicontrol(‘Style’,’text’,’Units’,’normalized’,’Position’,[0.125/2+0.005,toprowtextheight,0.24,0.03] …
,’String’,’Flow Measurement’,’BackgroundColor’,buttoncolor,’ForegroundColor’,textcolor …
,’FontWeight’,’bold’,’FontSize’,7) ;
function buttonfunction(object, ~, halfscreensizecentre,figurecolour) % function returns two outputs, object & event, event is not used so is denoted by ~
object.UserData ; % Finds out what UserData is, which is determined by which button is pressed.
if strcmpi(object.UserData,’1′) % strcmp is case-insensitive string compare
disp (‘Flow Measurement’)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour} % ERROR ON THIS LINE
else
disp(‘How did we get here?’)
end
end
I run the code press the button a recieve the following error message:
Not enough input arguments.
Error in Year_2_Applied_Thermofluids_Calculator>buttonfunction (line 48)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour}
Error while evaluating UIControl Callback.
Any advice on how to fix my code and achieve my desired outcome? Thank you for your time.Hello Reader! Basically, I am writing code that opens a figure with a button to be pressed on it, I want this button to open a figure saved in another file (same folder of course) as a function because this will keep the code tidy as a make more buttons/functions. I dont think figures works well on this online version of MATLAB.
Hello here is the function:
% Saved as flow_measurement
function flow_measurement(halfscreensizecentre,figurecolour)
figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider – Flow Measurement’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
end
Hello, here is part of my code:
screensize = get(groot,’ScreenSize’) ;
halfscreensizecentre = [(screensize(1,[3,4])/4),(screensize(1,[3 4]))/2] ;
figurecolour = [230/255 230/255 230/255] ;
figure1 = figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
buttoncolor = [0 64/255 115/255] ;
textcolor = [1 1 1] ;
toprowbuttonheight = 1 – 0.35 ;
toprowtextheight = toprowbuttonheight + 0.21 ;
flowmeasurementbutton = uicontrol(‘Style’,’pushbutton’,’Units’,’normalized’,’Position’,[.125/2,toprowbuttonheight,.25,.25],’BackgroundColor’,buttoncolor …
,’Callback’,@buttonfunction,’UserData’,’1′) ; % Creates a pushbutton
% Callback assigns button press to function following @
% UserData makes an output of 1
textonflowmeasurementbutton = uicontrol(‘Style’,’text’,’Units’,’normalized’,’Position’,[0.125/2+0.005,toprowtextheight,0.24,0.03] …
,’String’,’Flow Measurement’,’BackgroundColor’,buttoncolor,’ForegroundColor’,textcolor …
,’FontWeight’,’bold’,’FontSize’,7) ;
function buttonfunction(object, ~, halfscreensizecentre,figurecolour) % function returns two outputs, object & event, event is not used so is denoted by ~
object.UserData ; % Finds out what UserData is, which is determined by which button is pressed.
if strcmpi(object.UserData,’1′) % strcmp is case-insensitive string compare
disp (‘Flow Measurement’)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour} % ERROR ON THIS LINE
else
disp(‘How did we get here?’)
end
end
I run the code press the button a recieve the following error message:
Not enough input arguments.
Error in Year_2_Applied_Thermofluids_Calculator>buttonfunction (line 48)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour}
Error while evaluating UIControl Callback.
Any advice on how to fix my code and achieve my desired outcome? Thank you for your time. Hello Reader! Basically, I am writing code that opens a figure with a button to be pressed on it, I want this button to open a figure saved in another file (same folder of course) as a function because this will keep the code tidy as a make more buttons/functions. I dont think figures works well on this online version of MATLAB.
Hello here is the function:
% Saved as flow_measurement
function flow_measurement(halfscreensizecentre,figurecolour)
figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider – Flow Measurement’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
end
Hello, here is part of my code:
screensize = get(groot,’ScreenSize’) ;
halfscreensizecentre = [(screensize(1,[3,4])/4),(screensize(1,[3 4]))/2] ;
figurecolour = [230/255 230/255 230/255] ;
figure1 = figure(‘Name’,’Applied Thermofluids Calculator by Philip Schneider’,’Position’,halfscreensizecentre,’Color’,…
figurecolour,’MenuBar’,’none’,’NumberTitle’,’off’)
buttoncolor = [0 64/255 115/255] ;
textcolor = [1 1 1] ;
toprowbuttonheight = 1 – 0.35 ;
toprowtextheight = toprowbuttonheight + 0.21 ;
flowmeasurementbutton = uicontrol(‘Style’,’pushbutton’,’Units’,’normalized’,’Position’,[.125/2,toprowbuttonheight,.25,.25],’BackgroundColor’,buttoncolor …
,’Callback’,@buttonfunction,’UserData’,’1′) ; % Creates a pushbutton
% Callback assigns button press to function following @
% UserData makes an output of 1
textonflowmeasurementbutton = uicontrol(‘Style’,’text’,’Units’,’normalized’,’Position’,[0.125/2+0.005,toprowtextheight,0.24,0.03] …
,’String’,’Flow Measurement’,’BackgroundColor’,buttoncolor,’ForegroundColor’,textcolor …
,’FontWeight’,’bold’,’FontSize’,7) ;
function buttonfunction(object, ~, halfscreensizecentre,figurecolour) % function returns two outputs, object & event, event is not used so is denoted by ~
object.UserData ; % Finds out what UserData is, which is determined by which button is pressed.
if strcmpi(object.UserData,’1′) % strcmp is case-insensitive string compare
disp (‘Flow Measurement’)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour} % ERROR ON THIS LINE
else
disp(‘How did we get here?’)
end
end
I run the code press the button a recieve the following error message:
Not enough input arguments.
Error in Year_2_Applied_Thermofluids_Calculator>buttonfunction (line 48)
flowmeasurementfigure.Callback = {@flow_measurement,halfscreensizecentre,figurecolour}
Error while evaluating UIControl Callback.
Any advice on how to fix my code and achieve my desired outcome? Thank you for your time. not enough input arguments, figure, function MATLAB Answers — New Questions
Peak coming at 50Hz in every data file. How to get rid of that
I have amplitude and time data with me. After doing FFT of the data I plot amplitude vs frequency graph and after calculating power I plotted power vs frequency graph but everytime in my graph there is a peak at 50hz. and it comes in every data file. Please help me how to get rid of that. I have attached pictures of graph for your referenceI have amplitude and time data with me. After doing FFT of the data I plot amplitude vs frequency graph and after calculating power I plotted power vs frequency graph but everytime in my graph there is a peak at 50hz. and it comes in every data file. Please help me how to get rid of that. I have attached pictures of graph for your reference I have amplitude and time data with me. After doing FFT of the data I plot amplitude vs frequency graph and after calculating power I plotted power vs frequency graph but everytime in my graph there is a peak at 50hz. and it comes in every data file. Please help me how to get rid of that. I have attached pictures of graph for your reference fftpsd, filter in fourier domain, remove spike in spectrum. MATLAB Answers — New Questions
problem with tbl,xvar,yvar form of plot()
Greetings, as per title i have a problem with tbl,xvar,yvar form of plot().
I have an array with history of the evolution of the parameters of a function during parameter optimization.
num_iterations = size(param_history, 1);
num_chains = size(param_history, 2);
num_dimensions = size(param_history, 3);
param_at_step = zeros(num_iterations, num_chains * num_dimensions);
The array is of the form 10000×8 – 10k iterations by 2 parameters for each of the 4 independent optimization chains. I expected:
for iteration = 1 : num_iterations
for chain_id = 1 : num_chains
for param = 1 : num_dimensions
column = ((chain_id-1) * 2) + param;
param_at_step(iteration, column) = param_history(iteration, chain_id, param);
end
end
end
plot( param_at_step, [1 3 5 7], [2 4 6 8] );
to plot the evolution of the parameters in the parameter space, but i get an error:
Error using plot
Specify the coordinates as vectors or matrices of the same size, or as a vector and a matrix that share the same length in at least one dimension.
I am confused, what am I doing wrong?Greetings, as per title i have a problem with tbl,xvar,yvar form of plot().
I have an array with history of the evolution of the parameters of a function during parameter optimization.
num_iterations = size(param_history, 1);
num_chains = size(param_history, 2);
num_dimensions = size(param_history, 3);
param_at_step = zeros(num_iterations, num_chains * num_dimensions);
The array is of the form 10000×8 – 10k iterations by 2 parameters for each of the 4 independent optimization chains. I expected:
for iteration = 1 : num_iterations
for chain_id = 1 : num_chains
for param = 1 : num_dimensions
column = ((chain_id-1) * 2) + param;
param_at_step(iteration, column) = param_history(iteration, chain_id, param);
end
end
end
plot( param_at_step, [1 3 5 7], [2 4 6 8] );
to plot the evolution of the parameters in the parameter space, but i get an error:
Error using plot
Specify the coordinates as vectors or matrices of the same size, or as a vector and a matrix that share the same length in at least one dimension.
I am confused, what am I doing wrong? Greetings, as per title i have a problem with tbl,xvar,yvar form of plot().
I have an array with history of the evolution of the parameters of a function during parameter optimization.
num_iterations = size(param_history, 1);
num_chains = size(param_history, 2);
num_dimensions = size(param_history, 3);
param_at_step = zeros(num_iterations, num_chains * num_dimensions);
The array is of the form 10000×8 – 10k iterations by 2 parameters for each of the 4 independent optimization chains. I expected:
for iteration = 1 : num_iterations
for chain_id = 1 : num_chains
for param = 1 : num_dimensions
column = ((chain_id-1) * 2) + param;
param_at_step(iteration, column) = param_history(iteration, chain_id, param);
end
end
end
plot( param_at_step, [1 3 5 7], [2 4 6 8] );
to plot the evolution of the parameters in the parameter space, but i get an error:
Error using plot
Specify the coordinates as vectors or matrices of the same size, or as a vector and a matrix that share the same length in at least one dimension.
I am confused, what am I doing wrong? plot, array MATLAB Answers — New Questions
Using the TL-2P heat exchanger in simscape to simulate an external threaded tube heat exchanger
Using the TL-2P heat exchanger in simscape to simulate an external threaded tube heat exchanger, water and refrigerant are in a countercurrent process, water flows in the tube, and refrigerant r134a flows in a ring outside the tube. Then I use the experimental data to set in simscape, but the heat transfer cannot achieve the desired effect. What is the reason? I analyzed that it is caused by multiple encircling, is there any way to solve this problemUsing the TL-2P heat exchanger in simscape to simulate an external threaded tube heat exchanger, water and refrigerant are in a countercurrent process, water flows in the tube, and refrigerant r134a flows in a ring outside the tube. Then I use the experimental data to set in simscape, but the heat transfer cannot achieve the desired effect. What is the reason? I analyzed that it is caused by multiple encircling, is there any way to solve this problem Using the TL-2P heat exchanger in simscape to simulate an external threaded tube heat exchanger, water and refrigerant are in a countercurrent process, water flows in the tube, and refrigerant r134a flows in a ring outside the tube. Then I use the experimental data to set in simscape, but the heat transfer cannot achieve the desired effect. What is the reason? I analyzed that it is caused by multiple encircling, is there any way to solve this problem heat exchanger, fluid, cooling, chiller MATLAB Answers — New Questions
Installation R2021a behind proxy fails
Starting the installer stops with the following error:
The following error was encountered while trying to retrieve the URL:http://localhost:32415/ui/install/matlab_installer/matlab_installer/index.html?
Connection to ::1 failed
The system returned: (111) Connection refused
Disabling the proxy, the installer starts but requires a FIK key (which i can get from our license administrator) but every system in our subnet will have the same problem. Any idea how to solve this ?Starting the installer stops with the following error:
The following error was encountered while trying to retrieve the URL:http://localhost:32415/ui/install/matlab_installer/matlab_installer/index.html?
Connection to ::1 failed
The system returned: (111) Connection refused
Disabling the proxy, the installer starts but requires a FIK key (which i can get from our license administrator) but every system in our subnet will have the same problem. Any idea how to solve this ? Starting the installer stops with the following error:
The following error was encountered while trying to retrieve the URL:http://localhost:32415/ui/install/matlab_installer/matlab_installer/index.html?
Connection to ::1 failed
The system returned: (111) Connection refused
Disabling the proxy, the installer starts but requires a FIK key (which i can get from our license administrator) but every system in our subnet will have the same problem. Any idea how to solve this ? r2021a proxy MATLAB Answers — New Questions
Opening of serial port during GUI formation.
Hello everyone,
I am trying to create a GUI which uses serial port for communication. Here, I the GUI runs but I have to everytime open or pass the command to open the serial port when ever I have to communicate.
Is their a possible way by which I can open port just once inside the classdef method instead of writting it again and again in method (static) and opening it again and again. It consumes time and the GUI becomes slow.
I will kindly request, to please help to suggest ways by which I can open serial port only once and then communicate with it as many times as possible.
I have also attached a sample code specifying my current problem.
Thanking you,
Kind regards
classdef classEl < handle
properties
fig
daq
UI
position_limits
position_read_1
end
properties (SetObservable, AbortSet) % for listeners
position
pre_value
end
methods
function obj = classEl() % constructor
obj.position_limits = [0, 360];
addlistener(obj,’position’,’PostSet’,@classEl.handlePropEvents);
obj.position = [0 0 0 0]; % initial
obj.pre_value =[0 0 0 0];
obj.fig = uifigure( ‘Name’,class(obj),’Position’, [100 100 979 446]);
…
…
end
end
methods (Static)
function handlePropEvents(src,evnt)
obj = evnt.AffectedObject;
switch src.Name
case {‘position’,’pre_value’}
if(obj.pre_value(1) ~= obj.position(1))
serial_port =serialport("COM4",9600);
…
elseif(obj.pre_value(2) ~= obj.position(2))
serial_port =serialport("COM4",9600);
…
end
end
end
end
endHello everyone,
I am trying to create a GUI which uses serial port for communication. Here, I the GUI runs but I have to everytime open or pass the command to open the serial port when ever I have to communicate.
Is their a possible way by which I can open port just once inside the classdef method instead of writting it again and again in method (static) and opening it again and again. It consumes time and the GUI becomes slow.
I will kindly request, to please help to suggest ways by which I can open serial port only once and then communicate with it as many times as possible.
I have also attached a sample code specifying my current problem.
Thanking you,
Kind regards
classdef classEl < handle
properties
fig
daq
UI
position_limits
position_read_1
end
properties (SetObservable, AbortSet) % for listeners
position
pre_value
end
methods
function obj = classEl() % constructor
obj.position_limits = [0, 360];
addlistener(obj,’position’,’PostSet’,@classEl.handlePropEvents);
obj.position = [0 0 0 0]; % initial
obj.pre_value =[0 0 0 0];
obj.fig = uifigure( ‘Name’,class(obj),’Position’, [100 100 979 446]);
…
…
end
end
methods (Static)
function handlePropEvents(src,evnt)
obj = evnt.AffectedObject;
switch src.Name
case {‘position’,’pre_value’}
if(obj.pre_value(1) ~= obj.position(1))
serial_port =serialport("COM4",9600);
…
elseif(obj.pre_value(2) ~= obj.position(2))
serial_port =serialport("COM4",9600);
…
end
end
end
end
end Hello everyone,
I am trying to create a GUI which uses serial port for communication. Here, I the GUI runs but I have to everytime open or pass the command to open the serial port when ever I have to communicate.
Is their a possible way by which I can open port just once inside the classdef method instead of writting it again and again in method (static) and opening it again and again. It consumes time and the GUI becomes slow.
I will kindly request, to please help to suggest ways by which I can open serial port only once and then communicate with it as many times as possible.
I have also attached a sample code specifying my current problem.
Thanking you,
Kind regards
classdef classEl < handle
properties
fig
daq
UI
position_limits
position_read_1
end
properties (SetObservable, AbortSet) % for listeners
position
pre_value
end
methods
function obj = classEl() % constructor
obj.position_limits = [0, 360];
addlistener(obj,’position’,’PostSet’,@classEl.handlePropEvents);
obj.position = [0 0 0 0]; % initial
obj.pre_value =[0 0 0 0];
obj.fig = uifigure( ‘Name’,class(obj),’Position’, [100 100 979 446]);
…
…
end
end
methods (Static)
function handlePropEvents(src,evnt)
obj = evnt.AffectedObject;
switch src.Name
case {‘position’,’pre_value’}
if(obj.pre_value(1) ~= obj.position(1))
serial_port =serialport("COM4",9600);
…
elseif(obj.pre_value(2) ~= obj.position(2))
serial_port =serialport("COM4",9600);
…
end
end
end
end
end serial port, gui, time saving MATLAB Answers — New Questions
Pulstran function to generate biphasic pulses
How can I correct following code to get pulses like on the picture? I don’t get correct shape of pulses.
Parameters: N = 400 (number of pulses), Tp = 1 (pulse width), d1 = 1 (interphase delay [us]), d2 = 1 (interpulse delay [us]). Let’s say the U0=1V. It should look like this:
number_of_points_on_interval = 1000;
t = linspace(0, 1.6, 10000);
Tp = 0.001; %pulse width [ms]
d1 = 0.001; %interphase delay [ms]
d2 = 0.001; %interpulse delay [ms]
dPos = 0.001:(d1+Tp+d2):1.6; % times when positive pulses start
dNeg = dPos + Tp + 0.001; % times when negative pulses start
dT = [dPos dNeg]’; % times of pulses
% Amplitude of positive and negative pulses
U=1;
dAmp = [U*ones(numel(dPos),1); -1 * U*ones(numel(dNeg),1)];
% generating a signal with rectangular pulses
y = pulstran(t,[dT dAmp],’rectpuls’,Tp);
plot(t,y)
ylim paddedHow can I correct following code to get pulses like on the picture? I don’t get correct shape of pulses.
Parameters: N = 400 (number of pulses), Tp = 1 (pulse width), d1 = 1 (interphase delay [us]), d2 = 1 (interpulse delay [us]). Let’s say the U0=1V. It should look like this:
number_of_points_on_interval = 1000;
t = linspace(0, 1.6, 10000);
Tp = 0.001; %pulse width [ms]
d1 = 0.001; %interphase delay [ms]
d2 = 0.001; %interpulse delay [ms]
dPos = 0.001:(d1+Tp+d2):1.6; % times when positive pulses start
dNeg = dPos + Tp + 0.001; % times when negative pulses start
dT = [dPos dNeg]’; % times of pulses
% Amplitude of positive and negative pulses
U=1;
dAmp = [U*ones(numel(dPos),1); -1 * U*ones(numel(dNeg),1)];
% generating a signal with rectangular pulses
y = pulstran(t,[dT dAmp],’rectpuls’,Tp);
plot(t,y)
ylim padded How can I correct following code to get pulses like on the picture? I don’t get correct shape of pulses.
Parameters: N = 400 (number of pulses), Tp = 1 (pulse width), d1 = 1 (interphase delay [us]), d2 = 1 (interpulse delay [us]). Let’s say the U0=1V. It should look like this:
number_of_points_on_interval = 1000;
t = linspace(0, 1.6, 10000);
Tp = 0.001; %pulse width [ms]
d1 = 0.001; %interphase delay [ms]
d2 = 0.001; %interpulse delay [ms]
dPos = 0.001:(d1+Tp+d2):1.6; % times when positive pulses start
dNeg = dPos + Tp + 0.001; % times when negative pulses start
dT = [dPos dNeg]’; % times of pulses
% Amplitude of positive and negative pulses
U=1;
dAmp = [U*ones(numel(dPos),1); -1 * U*ones(numel(dNeg),1)];
% generating a signal with rectangular pulses
y = pulstran(t,[dT dAmp],’rectpuls’,Tp);
plot(t,y)
ylim padded pulstran, pulses, biphasic, rectangular MATLAB Answers — New Questions
Disable Parsim Warning Messages
I am running a Simscape model using Parsim.
This is the function I am using to run Parsim. When I look in the simulation manager, In the diagnostics section, I still see warnings. Will these slow down simulations? How do I force warning to be supressed and why does the ‘warning off’ in my code not work?
Thanks.
function [SimOutput] = SimSweep(model_name,variable_name_1,variable_array_1,variable_name_2,variable_array_2)
isModelOpen = bdIsLoaded(model_name);
open_system(model_name);
warning off;
% Main loop to sweep over conditions
for ii = 1:length(variable_array_1)
for jj = 1:length(variable_array_2)
warning off
in(ii,jj) = Simulink.SimulationInput(model_name);
in(ii,jj) = setVariable(in(ii,jj), variable_name_1, variable_array_1(ii));
in(ii,jj) = setVariable(in(ii,jj), variable_name_2, variable_array_2(jj));
end
end
SimOutput = parsim(in, ‘TransferBaseWorkspaceVariables’, ‘on’, ‘ShowSimulationManager’, ‘on’, ‘ShowProgress’, ‘on’);
endI am running a Simscape model using Parsim.
This is the function I am using to run Parsim. When I look in the simulation manager, In the diagnostics section, I still see warnings. Will these slow down simulations? How do I force warning to be supressed and why does the ‘warning off’ in my code not work?
Thanks.
function [SimOutput] = SimSweep(model_name,variable_name_1,variable_array_1,variable_name_2,variable_array_2)
isModelOpen = bdIsLoaded(model_name);
open_system(model_name);
warning off;
% Main loop to sweep over conditions
for ii = 1:length(variable_array_1)
for jj = 1:length(variable_array_2)
warning off
in(ii,jj) = Simulink.SimulationInput(model_name);
in(ii,jj) = setVariable(in(ii,jj), variable_name_1, variable_array_1(ii));
in(ii,jj) = setVariable(in(ii,jj), variable_name_2, variable_array_2(jj));
end
end
SimOutput = parsim(in, ‘TransferBaseWorkspaceVariables’, ‘on’, ‘ShowSimulationManager’, ‘on’, ‘ShowProgress’, ‘on’);
end I am running a Simscape model using Parsim.
This is the function I am using to run Parsim. When I look in the simulation manager, In the diagnostics section, I still see warnings. Will these slow down simulations? How do I force warning to be supressed and why does the ‘warning off’ in my code not work?
Thanks.
function [SimOutput] = SimSweep(model_name,variable_name_1,variable_array_1,variable_name_2,variable_array_2)
isModelOpen = bdIsLoaded(model_name);
open_system(model_name);
warning off;
% Main loop to sweep over conditions
for ii = 1:length(variable_array_1)
for jj = 1:length(variable_array_2)
warning off
in(ii,jj) = Simulink.SimulationInput(model_name);
in(ii,jj) = setVariable(in(ii,jj), variable_name_1, variable_array_1(ii));
in(ii,jj) = setVariable(in(ii,jj), variable_name_2, variable_array_2(jj));
end
end
SimOutput = parsim(in, ‘TransferBaseWorkspaceVariables’, ‘on’, ‘ShowSimulationManager’, ‘on’, ‘ShowProgress’, ‘on’);
end parallel computing toolbox, simscape MATLAB Answers — New Questions
array exceeds maximum array size preference
i had this error :
Requested 65536×65536 (32.0GB) array exceeds maximum array size preference. Creation of arrays greater than this
limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for
more information.
AT LIGNE n°3:
s_old = s;
s = [s(N*M-L+1:N*M);s];
EYE_MAT = eye(length(s_old));
PI_mat = [EYE_MAT(:, 2:end) EYE_MAT(:, 1)];
can some one help me pllllz !i had this error :
Requested 65536×65536 (32.0GB) array exceeds maximum array size preference. Creation of arrays greater than this
limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for
more information.
AT LIGNE n°3:
s_old = s;
s = [s(N*M-L+1:N*M);s];
EYE_MAT = eye(length(s_old));
PI_mat = [EYE_MAT(:, 2:end) EYE_MAT(:, 1)];
can some one help me pllllz ! i had this error :
Requested 65536×65536 (32.0GB) array exceeds maximum array size preference. Creation of arrays greater than this
limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for
more information.
AT LIGNE n°3:
s_old = s;
s = [s(N*M-L+1:N*M);s];
EYE_MAT = eye(length(s_old));
PI_mat = [EYE_MAT(:, 2:end) EYE_MAT(:, 1)];
can some one help me pllllz ! array exceeds maximum array size preference, matlab to become unresponsive, array size limit, (32.0gb) array exceeds maximum array size MATLAB Answers — New Questions
Matlab R2017a and Visual C++ 2013 issues (No supported compiler was found)
A few days ago, I ran into problems with Quanser’s QuaRC that requires a compatible C++ compiler. I’m using Matlab R2017a.
I reinstalled Visual Studio Ultimate 2013, from the ISO image @
https://my.visualstudio.com/Downloads?q=visual%20studio%202013&wt.mc_id=o~msft~vscom~older-downloads
Regardless of the number of "solutions" I’ve tried from reading the MathWorks Community, I get the same error message, namely so supported compiler was found. I uninstalled MinGW64 (which was successfully detected) since it is not supported by QuaRC, which requires that I only use Visual C++ 2013 or 2015.. Here is the output that I get from
==========================================================================
>> mex -v -setup
Verbose mode is on.
… Looking for compiler ‘Intel C++ Composer XE 2013 with Microsoft SDK 7.1 (C)’ …
<snip>
Did not find installed compiler ‘Microsoft Visual C++ 2012 (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2013 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for file ‘C:Program Files (x86)Microsoft Visual Studio 12.0VCbinamd64cl.exe’ …Yes.
… Looking for folder ‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’ …Yes.
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …Yes (‘C:Program Files (x86)Windows Kits8.1’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’).
… Looking for environment variable ‘VS120COMNTOOLS’ …Yes (‘C:Program Files (x86)Common7Tools’).
… Looking for file ‘C:Program Files (x86)Common7IDEdevenv.exe’ …No.
Did not find installed compiler ‘Microsoft Visual C++ 2013 Professional (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2015 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
Did not find installed compiler ‘Microsoft Visual C++ 2015 Professional (C)’.
… Looking for compiler ‘Microsoft Windows SDK 7.1 (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
Did not find installed compiler ‘Microsoft Windows SDK 7.1 (C)’.
… Looking for compiler ‘MinGW64 Compiler (C)’ …
… Looking for environment variable ‘MW_MINGW64_LOC’ …No.
Did not find installed compiler ‘MinGW64 Compiler (C)’.
Error using mex
No supported compiler or SDK was found.
===============================================================================A few days ago, I ran into problems with Quanser’s QuaRC that requires a compatible C++ compiler. I’m using Matlab R2017a.
I reinstalled Visual Studio Ultimate 2013, from the ISO image @
https://my.visualstudio.com/Downloads?q=visual%20studio%202013&wt.mc_id=o~msft~vscom~older-downloads
Regardless of the number of "solutions" I’ve tried from reading the MathWorks Community, I get the same error message, namely so supported compiler was found. I uninstalled MinGW64 (which was successfully detected) since it is not supported by QuaRC, which requires that I only use Visual C++ 2013 or 2015.. Here is the output that I get from
==========================================================================
>> mex -v -setup
Verbose mode is on.
… Looking for compiler ‘Intel C++ Composer XE 2013 with Microsoft SDK 7.1 (C)’ …
<snip>
Did not find installed compiler ‘Microsoft Visual C++ 2012 (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2013 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for file ‘C:Program Files (x86)Microsoft Visual Studio 12.0VCbinamd64cl.exe’ …Yes.
… Looking for folder ‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’ …Yes.
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …Yes (‘C:Program Files (x86)Windows Kits8.1’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’).
… Looking for environment variable ‘VS120COMNTOOLS’ …Yes (‘C:Program Files (x86)Common7Tools’).
… Looking for file ‘C:Program Files (x86)Common7IDEdevenv.exe’ …No.
Did not find installed compiler ‘Microsoft Visual C++ 2013 Professional (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2015 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
Did not find installed compiler ‘Microsoft Visual C++ 2015 Professional (C)’.
… Looking for compiler ‘Microsoft Windows SDK 7.1 (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
Did not find installed compiler ‘Microsoft Windows SDK 7.1 (C)’.
… Looking for compiler ‘MinGW64 Compiler (C)’ …
… Looking for environment variable ‘MW_MINGW64_LOC’ …No.
Did not find installed compiler ‘MinGW64 Compiler (C)’.
Error using mex
No supported compiler or SDK was found.
=============================================================================== A few days ago, I ran into problems with Quanser’s QuaRC that requires a compatible C++ compiler. I’m using Matlab R2017a.
I reinstalled Visual Studio Ultimate 2013, from the ISO image @
https://my.visualstudio.com/Downloads?q=visual%20studio%202013&wt.mc_id=o~msft~vscom~older-downloads
Regardless of the number of "solutions" I’ve tried from reading the MathWorks Community, I get the same error message, namely so supported compiler was found. I uninstalled MinGW64 (which was successfully detected) since it is not supported by QuaRC, which requires that I only use Visual C++ 2013 or 2015.. Here is the output that I get from
==========================================================================
>> mex -v -setup
Verbose mode is on.
… Looking for compiler ‘Intel C++ Composer XE 2013 with Microsoft SDK 7.1 (C)’ …
<snip>
Did not find installed compiler ‘Microsoft Visual C++ 2012 (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2013 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for file ‘C:Program Files (x86)Microsoft Visual Studio 12.0VCbinamd64cl.exe’ …Yes.
… Looking for folder ‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’ …Yes.
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv8.1’ InstallationFolder …Yes (‘C:Program Files (x86)Windows Kits8.1’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0’).
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVC7’ 12.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVC7’ 12.0 …Yes (‘C:Program Files (x86)Microsoft Visual Studio 12.0VC’).
… Looking for environment variable ‘VS120COMNTOOLS’ …Yes (‘C:Program Files (x86)Common7Tools’).
… Looking for file ‘C:Program Files (x86)Common7IDEdevenv.exe’ …No.
Did not find installed compiler ‘Microsoft Visual C++ 2013 Professional (C)’.
… Looking for compiler ‘Microsoft Visual C++ 2015 Professional (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
… Looking for registry setting ‘HKCUSOFTWAREWow6432NodeMicrosoftVisualStudioSxSVS7’ 14.0 …No.
Did not find installed compiler ‘Microsoft Visual C++ 2015 Professional (C)’.
… Looking for compiler ‘Microsoft Windows SDK 7.1 (C)’ …
… Looking for registry setting ‘HKLMSOFTWAREMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
… Looking for registry setting ‘HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindowsv7.1’ InstallationFolder …No.
Did not find installed compiler ‘Microsoft Windows SDK 7.1 (C)’.
… Looking for compiler ‘MinGW64 Compiler (C)’ …
… Looking for environment variable ‘MW_MINGW64_LOC’ …No.
Did not find installed compiler ‘MinGW64 Compiler (C)’.
Error using mex
No supported compiler or SDK was found.
=============================================================================== visual c++ 2013 MATLAB Answers — New Questions
Link a MATLAB App with System Composer Architecture Model
Hi,
I was wondering that is there a way to link an Architectural Model developed using Systems Composer with an application developed using MATLAB App?Hi,
I was wondering that is there a way to link an Architectural Model developed using Systems Composer with an application developed using MATLAB App? Hi,
I was wondering that is there a way to link an Architectural Model developed using Systems Composer with an application developed using MATLAB App? systems engineering, systems composer, matlab app, mbse MATLAB Answers — New Questions
My datetimes do not give the right logical values
EventStartTimeEditField = "2023-07-20 09:00:02.798410112"
Event_start_time = datetime(EventStartTimeEditField,’InputFormat’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’Format’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’TimeZone’,’America/Halifax’)
find(acc_data.Time == Event_start_time)
The value of index 1793 of acc_data.Time is the following datetime: 2023-07-20 09:00:02.798410112
Despite these two values being identical, making a logical returns the wrong value for this index and the find function can not find the index at which the values are equal.
Does anyone have any ideas why this is and how to fix it?EventStartTimeEditField = "2023-07-20 09:00:02.798410112"
Event_start_time = datetime(EventStartTimeEditField,’InputFormat’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’Format’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’TimeZone’,’America/Halifax’)
find(acc_data.Time == Event_start_time)
The value of index 1793 of acc_data.Time is the following datetime: 2023-07-20 09:00:02.798410112
Despite these two values being identical, making a logical returns the wrong value for this index and the find function can not find the index at which the values are equal.
Does anyone have any ideas why this is and how to fix it? EventStartTimeEditField = "2023-07-20 09:00:02.798410112"
Event_start_time = datetime(EventStartTimeEditField,’InputFormat’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’Format’,’yyyy-MM-dd HH:mm:ss.SSSSSSSSS’,’TimeZone’,’America/Halifax’)
find(acc_data.Time == Event_start_time)
The value of index 1793 of acc_data.Time is the following datetime: 2023-07-20 09:00:02.798410112
Despite these two values being identical, making a logical returns the wrong value for this index and the find function can not find the index at which the values are equal.
Does anyone have any ideas why this is and how to fix it? logical, datetime, find MATLAB Answers — New Questions
Bicubic Interpolation Algorithm of imrotate
Hello,
does anyone know the exact code for the bicubic interpolation algorithm used in imrotate()? I am currently rewriting a matlab script containing this function into a cuda mex file. My current implementation produces small differences between the matlab rotated images and the images I rotate. Is it the algorithm mentioned in this paper?
Thanks for your helpHello,
does anyone know the exact code for the bicubic interpolation algorithm used in imrotate()? I am currently rewriting a matlab script containing this function into a cuda mex file. My current implementation produces small differences between the matlab rotated images and the images I rotate. Is it the algorithm mentioned in this paper?
Thanks for your help Hello,
does anyone know the exact code for the bicubic interpolation algorithm used in imrotate()? I am currently rewriting a matlab script containing this function into a cuda mex file. My current implementation produces small differences between the matlab rotated images and the images I rotate. Is it the algorithm mentioned in this paper?
Thanks for your help bicubic interpolation, mex, cuda, imrotate, rotation algorithm MATLAB Answers — New Questions
Uniformly distributed random integers
The randi function in matlab generates uniformly distributed pseudo-random integers. If I want to generate uniformly distributed random values in the range of {0,0.05} and a step size of 0.01, how can I do it?The randi function in matlab generates uniformly distributed pseudo-random integers. If I want to generate uniformly distributed random values in the range of {0,0.05} and a step size of 0.01, how can I do it? The randi function in matlab generates uniformly distributed pseudo-random integers. If I want to generate uniformly distributed random values in the range of {0,0.05} and a step size of 0.01, how can I do it? rand MATLAB Answers — New Questions
how to obtain pathgains of winner2 channel
the channel is generated by the following code
BSAA = winner2.AntennaArray(‘UCA’, 1, 0.02); % UCA-8 array for BS
MSAA1 = winner2.AntennaArray(‘ULA’, 1, 0.01); % ULA-2 array for MS
MSIdx = [2];
BSIdx = {1};
numLinks = 2;
rndSeed = 5;
cfgLayout = winner2.layoutparset(MSIdx,BSIdx, numLinks,[BSAA,MSAA1],[],rndSeed);
cfgLayout.Pairing = [1 ; 2 ]; % Index in cfgLayout.Stations
cfgLayout.ScenarioVector = [6];
numBSSect = sum(cfgLayout.NofSect);
numMS = length(MSIdx);
cfgLayout.Stations(2).Velocity=[1.6;0;0];
cfgLayout.Stations(1).Pos(1:2) = [50, 150];
cfgLayout.Stations(2).Pos(1:2) = [10, 180]; % 8 meters away from BS
BSPos = cell2mat({cfgLayout.Stations(1:numBSSect).Pos});
MSPos = cell2mat({cfgLayout.Stations(numBSSect+1:end).Pos});
frameLen = 64; % Number of samples to be generated
cfgWim = winner2.wimparset;
cfgWim.NumTimeSamples = 80;
cfgWim.IntraClusterDsUsed = ‘yes’;
cfgWim.CenterFrequency = 2.76e9;
cfgWim.UniformTimeSampling = ‘yes’;
cfgWim.ShadowingModelUsed = ‘yes’;
cfgWim.PathLossModelUsed = ‘no’;
cfgWim.UseManualPropCondition = ‘yes’;
cfgWim.RandomSeed = 31415927;
cfgWim.NormalizeChannelOutputs=’false’;
downWINNERChan = comm.WINNER2Channel(cfgWim,cfgLayout);
and the input data is
sourceData = randi([0 1],(80,1);
then the pathgains and output are obainted
[ChanOut, pathGains] = downWINNERChan(sourceData);
pathGains1=squeeze(cell2mat(pathGains));
pathGains1=sum(pathGains)’;
rx_data=cell2mat(ChanOut);
tx_data_estimate=rx_data./pathGains;
I wonder why tx_data_estimate is different from sourceData?the channel is generated by the following code
BSAA = winner2.AntennaArray(‘UCA’, 1, 0.02); % UCA-8 array for BS
MSAA1 = winner2.AntennaArray(‘ULA’, 1, 0.01); % ULA-2 array for MS
MSIdx = [2];
BSIdx = {1};
numLinks = 2;
rndSeed = 5;
cfgLayout = winner2.layoutparset(MSIdx,BSIdx, numLinks,[BSAA,MSAA1],[],rndSeed);
cfgLayout.Pairing = [1 ; 2 ]; % Index in cfgLayout.Stations
cfgLayout.ScenarioVector = [6];
numBSSect = sum(cfgLayout.NofSect);
numMS = length(MSIdx);
cfgLayout.Stations(2).Velocity=[1.6;0;0];
cfgLayout.Stations(1).Pos(1:2) = [50, 150];
cfgLayout.Stations(2).Pos(1:2) = [10, 180]; % 8 meters away from BS
BSPos = cell2mat({cfgLayout.Stations(1:numBSSect).Pos});
MSPos = cell2mat({cfgLayout.Stations(numBSSect+1:end).Pos});
frameLen = 64; % Number of samples to be generated
cfgWim = winner2.wimparset;
cfgWim.NumTimeSamples = 80;
cfgWim.IntraClusterDsUsed = ‘yes’;
cfgWim.CenterFrequency = 2.76e9;
cfgWim.UniformTimeSampling = ‘yes’;
cfgWim.ShadowingModelUsed = ‘yes’;
cfgWim.PathLossModelUsed = ‘no’;
cfgWim.UseManualPropCondition = ‘yes’;
cfgWim.RandomSeed = 31415927;
cfgWim.NormalizeChannelOutputs=’false’;
downWINNERChan = comm.WINNER2Channel(cfgWim,cfgLayout);
and the input data is
sourceData = randi([0 1],(80,1);
then the pathgains and output are obainted
[ChanOut, pathGains] = downWINNERChan(sourceData);
pathGains1=squeeze(cell2mat(pathGains));
pathGains1=sum(pathGains)’;
rx_data=cell2mat(ChanOut);
tx_data_estimate=rx_data./pathGains;
I wonder why tx_data_estimate is different from sourceData? the channel is generated by the following code
BSAA = winner2.AntennaArray(‘UCA’, 1, 0.02); % UCA-8 array for BS
MSAA1 = winner2.AntennaArray(‘ULA’, 1, 0.01); % ULA-2 array for MS
MSIdx = [2];
BSIdx = {1};
numLinks = 2;
rndSeed = 5;
cfgLayout = winner2.layoutparset(MSIdx,BSIdx, numLinks,[BSAA,MSAA1],[],rndSeed);
cfgLayout.Pairing = [1 ; 2 ]; % Index in cfgLayout.Stations
cfgLayout.ScenarioVector = [6];
numBSSect = sum(cfgLayout.NofSect);
numMS = length(MSIdx);
cfgLayout.Stations(2).Velocity=[1.6;0;0];
cfgLayout.Stations(1).Pos(1:2) = [50, 150];
cfgLayout.Stations(2).Pos(1:2) = [10, 180]; % 8 meters away from BS
BSPos = cell2mat({cfgLayout.Stations(1:numBSSect).Pos});
MSPos = cell2mat({cfgLayout.Stations(numBSSect+1:end).Pos});
frameLen = 64; % Number of samples to be generated
cfgWim = winner2.wimparset;
cfgWim.NumTimeSamples = 80;
cfgWim.IntraClusterDsUsed = ‘yes’;
cfgWim.CenterFrequency = 2.76e9;
cfgWim.UniformTimeSampling = ‘yes’;
cfgWim.ShadowingModelUsed = ‘yes’;
cfgWim.PathLossModelUsed = ‘no’;
cfgWim.UseManualPropCondition = ‘yes’;
cfgWim.RandomSeed = 31415927;
cfgWim.NormalizeChannelOutputs=’false’;
downWINNERChan = comm.WINNER2Channel(cfgWim,cfgLayout);
and the input data is
sourceData = randi([0 1],(80,1);
then the pathgains and output are obainted
[ChanOut, pathGains] = downWINNERChan(sourceData);
pathGains1=squeeze(cell2mat(pathGains));
pathGains1=sum(pathGains)’;
rx_data=cell2mat(ChanOut);
tx_data_estimate=rx_data./pathGains;
I wonder why tx_data_estimate is different from sourceData? winner2channel, equalization MATLAB Answers — New Questions
How to convert class cell to vector?
wavelet = ‘db4’;
level = 6;
tt=0:(0.25*10^(-3)):(0.25*10^(-3))*ceil(N);
ref=cos(2*pi*50*tt);
[CR, LR] = wavedec(CurrentwindowR, level, wavelet);
[CY, LY] = wavedec(CurrentwindowY, level, wavelet);
[CB, LB] = wavedec(CurrentwindowB, level, wavelet);
[CRvolt, LRvolt] = wavedec(VoltagewindowR, level, wavelet);
[CYvolt, LYvolt] = wavedec(VoltagewindowY, level, wavelet);
[CBvolt, LBvolt] = wavedec(VoltagewindowB, level, wavelet);
[Cref, Lref] = wavedec(ref, level, wavelet);
coder.extrinsic(‘str2double’)
AppR=str2double(detcoef(CR,LR,level));
AppY=str2double(detcoef(CY,LY,level));
AppB=str2double(detcoef(CB,LB,level));
AppvoltR=str2double(detcoef(CRvolt,LRvolt,level));
AppvoltY=str2double(detcoef(CYvolt,LYvolt,level));
AppvoltB=str2double(detcoef(CBvolt,LBvolt,level));
Appref=str2double(detcoef(Cref,Lref,level));
thetaR= acosd((dot(Appref,AppR))/(norm(Appref)*norm(AppR)));
thetaY= acosd((dot(Appref,AppY))/(norm(Appref)*norm(AppY)));
thetaB= acosd((dot(Appref,AppB))/(norm(Appref)*norm(AppB)));
refR=cos(2*pi*50*tt+thetaR*pi/180);
refY=cos(2*pi*50*tt+thetaY*pi/180);
refB=cos(2*pi*50*tt+thetaB*pi/180);wavelet = ‘db4’;
level = 6;
tt=0:(0.25*10^(-3)):(0.25*10^(-3))*ceil(N);
ref=cos(2*pi*50*tt);
[CR, LR] = wavedec(CurrentwindowR, level, wavelet);
[CY, LY] = wavedec(CurrentwindowY, level, wavelet);
[CB, LB] = wavedec(CurrentwindowB, level, wavelet);
[CRvolt, LRvolt] = wavedec(VoltagewindowR, level, wavelet);
[CYvolt, LYvolt] = wavedec(VoltagewindowY, level, wavelet);
[CBvolt, LBvolt] = wavedec(VoltagewindowB, level, wavelet);
[Cref, Lref] = wavedec(ref, level, wavelet);
coder.extrinsic(‘str2double’)
AppR=str2double(detcoef(CR,LR,level));
AppY=str2double(detcoef(CY,LY,level));
AppB=str2double(detcoef(CB,LB,level));
AppvoltR=str2double(detcoef(CRvolt,LRvolt,level));
AppvoltY=str2double(detcoef(CYvolt,LYvolt,level));
AppvoltB=str2double(detcoef(CBvolt,LBvolt,level));
Appref=str2double(detcoef(Cref,Lref,level));
thetaR= acosd((dot(Appref,AppR))/(norm(Appref)*norm(AppR)));
thetaY= acosd((dot(Appref,AppY))/(norm(Appref)*norm(AppY)));
thetaB= acosd((dot(Appref,AppB))/(norm(Appref)*norm(AppB)));
refR=cos(2*pi*50*tt+thetaR*pi/180);
refY=cos(2*pi*50*tt+thetaY*pi/180);
refB=cos(2*pi*50*tt+thetaB*pi/180); wavelet = ‘db4’;
level = 6;
tt=0:(0.25*10^(-3)):(0.25*10^(-3))*ceil(N);
ref=cos(2*pi*50*tt);
[CR, LR] = wavedec(CurrentwindowR, level, wavelet);
[CY, LY] = wavedec(CurrentwindowY, level, wavelet);
[CB, LB] = wavedec(CurrentwindowB, level, wavelet);
[CRvolt, LRvolt] = wavedec(VoltagewindowR, level, wavelet);
[CYvolt, LYvolt] = wavedec(VoltagewindowY, level, wavelet);
[CBvolt, LBvolt] = wavedec(VoltagewindowB, level, wavelet);
[Cref, Lref] = wavedec(ref, level, wavelet);
coder.extrinsic(‘str2double’)
AppR=str2double(detcoef(CR,LR,level));
AppY=str2double(detcoef(CY,LY,level));
AppB=str2double(detcoef(CB,LB,level));
AppvoltR=str2double(detcoef(CRvolt,LRvolt,level));
AppvoltY=str2double(detcoef(CYvolt,LYvolt,level));
AppvoltB=str2double(detcoef(CBvolt,LBvolt,level));
Appref=str2double(detcoef(Cref,Lref,level));
thetaR= acosd((dot(Appref,AppR))/(norm(Appref)*norm(AppR)));
thetaY= acosd((dot(Appref,AppY))/(norm(Appref)*norm(AppY)));
thetaB= acosd((dot(Appref,AppB))/(norm(Appref)*norm(AppB)));
refR=cos(2*pi*50*tt+thetaR*pi/180);
refY=cos(2*pi*50*tt+thetaY*pi/180);
refB=cos(2*pi*50*tt+thetaB*pi/180); discrete wavelet, detcoef, cell to vector MATLAB Answers — New Questions
Map plot overlaying frame
Hi,
I am plotting a map, but the plot overlays the frame:
<</matlabcentral/answers/uploaded_files/95537/frame_issue.jpg>>
I have tried setting the ‘Layer’ property to both ‘top’ and ‘bottom’, but it does nothing. Any other ideas? I guess alternatively I could move the position of the plot within the frame to be more central, but I don’t know how to do this.
The code I am using to set up my map is:
fob = figure;
%mollweid eqacylin behrmann robinson
h=axesm(‘MapProjection’,’behrmann’,’MapLatLimit’,latlim,’MapLonLimit’,lonlim,’Frame’,’on’,’FLineWidth’,6,’Grid’,’off’,’MLineLocation’,2,’meridianlabel’,’on’,’PLineLocation’,2,’parallellabel’,’on’,’fontsize’,26);
set(gcf,’PaperOrientation’,’portrait’,’Color’,’w’,’Position’,get(0,’Screensize’),’PaperPositionMode’,’auto’,’Renderer’,’painters’)
set(gca,’box’,’off’,’Visible’,’off’,’Layer’,’top’);
Any advice would be gratefully received.
SallyHi,
I am plotting a map, but the plot overlays the frame:
<</matlabcentral/answers/uploaded_files/95537/frame_issue.jpg>>
I have tried setting the ‘Layer’ property to both ‘top’ and ‘bottom’, but it does nothing. Any other ideas? I guess alternatively I could move the position of the plot within the frame to be more central, but I don’t know how to do this.
The code I am using to set up my map is:
fob = figure;
%mollweid eqacylin behrmann robinson
h=axesm(‘MapProjection’,’behrmann’,’MapLatLimit’,latlim,’MapLonLimit’,lonlim,’Frame’,’on’,’FLineWidth’,6,’Grid’,’off’,’MLineLocation’,2,’meridianlabel’,’on’,’PLineLocation’,2,’parallellabel’,’on’,’fontsize’,26);
set(gcf,’PaperOrientation’,’portrait’,’Color’,’w’,’Position’,get(0,’Screensize’),’PaperPositionMode’,’auto’,’Renderer’,’painters’)
set(gca,’box’,’off’,’Visible’,’off’,’Layer’,’top’);
Any advice would be gratefully received.
Sally Hi,
I am plotting a map, but the plot overlays the frame:
<</matlabcentral/answers/uploaded_files/95537/frame_issue.jpg>>
I have tried setting the ‘Layer’ property to both ‘top’ and ‘bottom’, but it does nothing. Any other ideas? I guess alternatively I could move the position of the plot within the frame to be more central, but I don’t know how to do this.
The code I am using to set up my map is:
fob = figure;
%mollweid eqacylin behrmann robinson
h=axesm(‘MapProjection’,’behrmann’,’MapLatLimit’,latlim,’MapLonLimit’,lonlim,’Frame’,’on’,’FLineWidth’,6,’Grid’,’off’,’MLineLocation’,2,’meridianlabel’,’on’,’PLineLocation’,2,’parallellabel’,’on’,’fontsize’,26);
set(gcf,’PaperOrientation’,’portrait’,’Color’,’w’,’Position’,get(0,’Screensize’),’PaperPositionMode’,’auto’,’Renderer’,’painters’)
set(gca,’box’,’off’,’Visible’,’off’,’Layer’,’top’);
Any advice would be gratefully received.
Sally mapping toolbox, frame, plotting MATLAB Answers — New Questions