Skip to main content

Posts

Showing posts from March, 2021

Stretch the dynamic range of the given 8-bit grayscale image using MATL...

How can I augment a toolbox to improve its capabilities?

  I am using the Robotics Systems Toolbox and its rotm2eul() function only takes in 3 possible rotation orders, XYZ, ZYX, and ZYZ. With permutations of these types there are 12 possibilities and matlab only works with a quarter of them. Adding support for the others is trivial thanks to the intelligent way the others were programmed. I only need to add 9 lines of code and remove a number of duplicated code statements in various code blocks.  % Pre-populate settings for different axis orderings % Each setting has 4 values: % 1. firstAxis : The right-most axis of the rotation order. Here, X=1, % Y=2, and Z=3. % 2. repetition : If the first axis and the last axis are equal in % the sequence, then repetition = 1; otherwise repetition = 0. % 3. parity : Parity is 0 if the right two axes in the sequence are % YX, ZY, or XZ. Otherwise, parity is 1. % 4. movingFrame : movingFrame = 1 if the rotations are with % reference to a moving frame. Otherwise (in the case of

How to save output from the for loop in a matrixs?

  Hi i have a   matrix  with M x n dimension. I have performed the peak analysis for each column in the for loop. I want to save the output for the for loop as a matrix.   I have used the following for loop.   for i=x [pks,locs]=findpeaks((i),'MinPeakHeight',Thresold) end I get output like this : ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. You can't pass (i) into findpeaks() - that's just a loop iterator, not a signal. You need to extract the column from your  matrix . Then, since each column is not guaranteed to have the same number of peaks, you'll need a cell array to store the results.     [rows, columns] = size(data) % Size of your 2-D matrix o

Populating ros messages is slow

  I noticed that populating ROS messages with values is quite slow. Filling 16 fields of a message takes in average around 2.2 ms. While this is not that much on its own, it quickly adds up in a control loop. The message in question is a control command which has to be sent at around 10 Hz to at least 10 different robots. That means at least a fifth of the control interval is spent on "creating" the messages. Together with the issue that  rostime("now")  is slow too (https://www.mathworks.com/matlabcentral/answers/658878-rostime-call-is-slow?s_tid=srchtitle), this leaves almost no time for the actual computation of the control commands.   I wonder if I am doing something fundamentally wrong or if the Matlab ROS API is simply that slow?   Script to time population of ROS message: cmdFullStateMsg = rosmessage("crazyflie_driver/FullState"); pos = ones(3, 1); vel = ones(3, 1); acc = ones(3, 1); yaw = 1; omega = ones(3, 1); quat = eul2quat([0, 0, yaw], 'xy

How to find Frequencies to filter?

  I am trying to find and determine what frequencies need filtering. I have an audio signal with a hiss noise at the first 2 seconds of my signal, the hiss has like 4 levels of hiss and each level increases and suddenly stops. I am trying to filter out that hiss using either FIR or IIR (haven't done a deeper research to decide which one to use, Probably FIR [but open for guidance]). My question is where do I look for my frequencies? I have the time signal, fft, spectogram, log scale. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. seems you need a low pass filter with a cut off frequency around 2.5 kHz - order to be defined / tested   you should apply it only on the first 1.7

Roadmap - how to save the graph generated?

  Hello. I have two occupancy grid. In one, I expect to generate a roadmap (PRM - probabilistic roadmap) with 100 nodes. Later, I want to reproduce the same nodes in the second map.   1: I'd like to handle the X Y variable of all nodes randomly generated in grid_1. How can I do that, please? Also, how to know the total number of paths generated?   2: Although I can't handle the random nodes, I'm able to replicate them using rng (random number generator), but in case the node in the second map is located in an occupated area, the algorithm generates another random number, which this is not what I want. For example, in grid_1, 100 nodes were generated. From those, only 90 is located in the free area on the grid_2, so I'd like to reproduce only those 90.   So far, this is how my code is:   image_1 = imread('image_1.pgm'); image_1 = image_1 < 250; % convert it to binary map_1 = binaryOccupancyMap(image_1, 0.05); % convert it to occupancy grid map rng(1) % save t

Why are IIR Filters designed in the Filter Design Toolbox more stable than those in the Signal Processing Toolbox?

  When designing filters you need normalized coefficients, and when they get very close or abut to 0 or 1, IIR goes unstable with the  Signal Processing   Toolbox. This effect is magnified for higher orders of the filter. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. The behavior observed is an expected behavior. This is a result of using the Transfer Function versus the Zeros and Poles of the filter generated by the BUTTER function in the  Signal Processing  Toolbox. They are identical mathematically but numerically the Zeros and Poles are more stable.   This limitation is mentioned in the   documentation  for the BUTTER function in Signal Processing Toolbox 6.9 (R2008a).   Th

Would I able to load a Gazebo world as a training model into rlSimulinkEnv function ?

  Hi, I'm trying to use   Simulink  to apply turtlebot3 to do deep reinforcement learning  simulation , the tutorial I'm following is from Robotics Arena  DRL for Walking Robots . I face a problem is that I want to load the Gazebo model such like turtlebot3_world.world instead of the walking robot model, but I didn't find any tutorial about it. Here is the code at the file createWalkingAgent2D.m % Environment mdl = 'walkingRobotRL2D'; load_system(mdl); blk = [mdl,'/RL Agent']; env = rlSimulinkEnv(mdl,blk,observationInfo,actionInfo); If there is anyone knows it, please give me some advicess. Thank you!! ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. Lo

Savitzky-Golay polynomial order returning NaN above 110

  Hi, I am a chemist and looking to do some smoothing on my data, but don't want it to be drastic, therefore I was trying to use the y=sgolayfilt(x,order,framelen) in   MATLAB  and input a polynomial order of over 500 for example, but each time I try to use an order above 110 the function returns 'NaN' for my whole   matrix .   Is this because the filter cannot support polynomials over 110? Or is there a way around this that will allow me to use higher order polynomials? I am sure I had previosuly been able to use polynomials above 110. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. I suspect you are confusing the order and the window length of the filter   You shoul

What is the difference between the Signal Processing Toolbox and the Filter Design Toolbox?

  I would like to know the difference between the Signal Processing Toolbox and the Filter Design Toolbox. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. The Filter Design Toolbox builds upon the  Signal Processing  Toolbox by adding advanced filter design algorithms, fixed-point filter analysis and  simulation , multirate filters, and adaptive filters. Some of the key features for the Filter Design Toolbox are: - Design and analysis of filters from the FDATool GUI or from the command line - Advanced FIR filter design methods: generalized Remez, halfband, Nyquist, interpolated FIR, CIC compensators, inverse-sinc, minimum-phase, constrained-ripple, sloped stopband, least Pth-norm

Why do I get different results with row or column vectors when using the

  Why do I get different results with row or column vectors when using the ROOTEIG or ROOTMUSIC functions in MATLAB 7.5 (R2007b) ? When I execute the ROOTEIG or ROOTMUSIC functions in MATLAB, I get different results with row or column vectors. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. The ' (apostrophe) is the conjugate transpose operator. What is needed for these two functions to give equal results when using row or column vectors is the array transpose operator: .'   Reproduction steps:     fs = 12; f0 = 2; t = ((1:1024)' - 1)/fs; x = exp(j*2*pi*f0*t) + .1*randn(1024, 1); % These lines give different results. fe = rooteig(x, 1, fs) SEE COMPLETE ANSWER

Why does the DECIMATE function not use the specified filter order in MATLAB 6.5 (R13)?

  I use the following syntax to specify a 7th order filter to be used in DECIMATE:     decimate(rand(1:100),31,7); However, when I check the filter that is actually used by putting a breakpoint on line 140 of decimate.m, I see that nfilt (the filter order) is actually set to 6. ANSWER Matlabsolutions.com  provide latest  MatLab Homework Help, MatLab Assignment Help  for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research. This is the correct behavior. The  MATLAB documentation  and MATLAB file help does not alert the user to the possibility of DECIMATE not using the specified filter order. In decimate.m on lines 126 to 132, the code lowers the filter order by evaluating the magnitude response of the filter at the cutoff frequency and comparing it to a threshold value of 1e-6.