Skip to main content

Posts

Showing posts from April, 2023

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

How to change property behavior for a mocked object

  I'm trying to use the mocking framework for unit tests   I'm trying to make the property of a mock object return another mock object, but the behavior object doesn't have the property   classdef MyClass properties (GetAccess=public, SetAccess=protected) prop1; end methods function this = answer() end end end this is the mock decleration: testCase = matlab.mock.TestCase.forInteractiveUse; [mock,behav] = testCase.createMock(?MyClass); % this would obciously throw an exception because the property set method is protected mock.prop1 = ""; You cannot set the read-only property 'prop1' of MyClassMock. % this throws an exception because the behavior object doesn't have this property p = behav.prop1; No appropriate method, property, or field 'prop1' for class 'matlab.mock.classes.MyClassBehavior'. now i can't set the value of the mock object because the set access is protected   a

How to add together values in matrix and replace the empty spaces with zeroes

  I have used a code that was written in someone elses previous question, that adds together all values over 0, after each zero.   So if you had : [0 0 0 2 3 4 0 0 0 5 2 1], you would get [9 8] However, what i would want is this [ 0 0 0 0 0 9 0 0 0 0 0 8] So basically replacing the "open" spaces with a 0   Anyone know how i can achieve this?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. hello   try this :   T = [0 0 0 2 3 4 0 0 0 5 2 1]; % input data T_out = zeros(size(T)); % find start and end indexes of groups of zeroes id_nonzero = (T>eps); [begin,ends] = find_start_end_group(id_nonzero); % loop over this groupes for k = 1:numel(

Want to insert a matrix in a for loop and change it with a variable

  Hello,   So, I have a variable phi(1x41) changing with lambda(1x41) and there is matrix (2x2) inside a for loop that needs to be changed with phi but the dimension of matrix should be (2x2x41) instead of (2x42) as it shown in workspace. Can anyone help me in this?   d1 = 0.1077; lam = 3:0.1:7; th = 0; n1 = 2.32; for j = 1:length(lam) phi1 =2*pi.*(d1./lam).*sqrt((n1).^2 - sind(th).^2); P1 = [exp(1i.*phi1) 0; 0 exp(-1i.*phi1)]; end     NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. d1 = 0.1077; lam = 3:0.1:7; th = 0; n1 = 2.32; %Define phi1 outside the loop as it is not varying with the loop phi1 = 2*pi.*(d1./lam).*sqrt((n1).^2 - sind(th).^2)

How to return random unique values based only on the value in each row for the first colomn?

  To get a sense of what I am trying to do:   A = [1, 15200, 3, 5, 7; 15200, 15200, 15200, 7,0; 1,1,1,1, 15200; 9200, 1, 1,1,1]; [val] = max(A, [], 2); indices = find(A==val); [row, col] = ind2sub(size(A), indices); sub = [row, col]; Now sub is a array as such [ 1,2 ; 2,1 ; 2,2 ; 2,3 ; 3,5; 4,1 ] and I want that only one value with 2 in the first colomn is returned, but randomly and not only the 2,1 but sometimes 2,2 or 2,3. So the output of my code should be an array with either [ 1,2 ; 2,1 ; 3,5; 4,1 ] or [ 1,2 ; 2,2 ; 3,5; 4,1 ] or [ 1,2 ; 2,3 ; 3,5; 4,1 ]. The code should also do this if the value was not 2 so if I had a, array with [ 1,2 ; 3,1 ; 3,2 ; 3,3 ; 3,5; 4,1 ] it would return only one value for 3 in the first column.   The idea is that I select 1 of the maximum values in the rows in the A-array, but not always the first one.   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance Assignment Help  for students, engineers and r

Detection of stars from the detected objects.

  Sir, My project is "Comets recognition from satellite images".I detected the objects from the image and the objects that are dtetected in the order of thousands.I need to detect and remove stars and cosmic rays from those detected objects. So please reply me soon.   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. If you have the  Image Processing Toolbox , you could start by trying regionprops. This allows you to measure various parameters of each object; you probably then need to analyse the results for some known objects to work out which combination of parameters distinguishes the different object classes best. SEE COMPLETE ANSWER CLICK T

Help increasing the speed of a piece of code

  Dear all,   Plain summary : I have a temperature matrix and I need to find the average temperature of the 8 pixels surrounding each pixel.   I need to  subdivide   my 134x134 matrices into 3x3 sub matrices .  For each submatrix I need to compute the mean and the standard deviation, excluding the central pixel from the calculation .   Then I need to  find the values exceding the upper and lower boundaries , namely the mean + standard deviation and the mean - standard deviation, respectively. Then, I need to  recalculate the mean excluding the values falling outside the lower and upper boundaries  and assign the mean value to the central pixel location (in a new matrix).   The output will be a 134x134 matrix with every value (pixel) corresponding to the average of its surrounding pixels with the "outliers" excluded from the average.   A=magic(134); % Assuming this is my 134x134 Temperature matrix T_background = blockproc(A,[1,1],@BlkFun, 'BorderSize',[1,1],... &#

Select values based on datetime

  Hello,   I have the matrix Values (1X2100) and the corresponding DateTime matrix with datetime data (1x2100 datetime). The values in Values matrix are hourly. I want to categorize the values of the Values table into 3 categories. I wrote the following codes for categorization,   [k1,i1]=find(Values<0); [k2,i2]=find(0<=Values & Values<=80; [k3,i3]=find(80<Values); Based on the i1, i2 and i3 I created the following matrices, Cat_Time_1=DateTime(i1); Cat_Time_2=DateTime(i2); Cat_Time_3=DateTime(i3); Cat_Time_1 (1X30 datetime), Cat_Time_2 (1X290 datetime) and cat_Time_3 (1X1780 datetime)   But what happens is the following: For example, in Cat_Time_1 there is 04-Jan-2012 04:00 and in Cat_Time_2 there is 04-Jan-2012 16:00. Another example is in Cat_Time_2 there is 16-Jan-2012 07:00 and in Cat_Time_3 there is the 16-Jan-2012 02:00. What I want is the same dates that exist in Cat_Time_1 and Cat_Time_2 stay in Cat_Time_1 and leave Cat_Time_2. The same dates that exist in Cat

How can I add linspace in a For Loop

  Hello good day, I wish to have a 'for' or 'while' loop which keeps increasing the value of 'x' as the value of 'phi' keeps increasing from 0 - 77.3049 with 100 numbers. I attempted a few times but kept getting errors. Any idea how this can be implemented?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. There is not enough information (such as a description of what you want to do).   However one possibility is something like this — phi = linspace(0, 77.3049, 100); for k = 1:numel(phi) x(k) = some_calculation_using(phi(k)); end   SEE COMPLETE ANSWER CLICK THE LINK https://www.matlabsolutions.com/resources/how-can-i

How do I add a time column in the format of YYYY-MM-DD to my table?

  I have a table containing time series data of some macroeconomic variables. My data is quarterly, starting from 1947-01-01 and ending on 2022-10-01. However, MATLAB is representing these dates numerically - eg, 1947-01-01 shows up as -725846400, after I imported the file into MATLAB from R. How do I change the time column to quarterly data in the range that I want?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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 think R stores dates as posix time. You can use something like this to convert to datetime format eg 31-Dec-1969 23:59:56 d = datetime(-725846400, 'ConvertFrom', 'posixtime')   SEE COMPLETE ANSWER CLICK THE LINK https://www

How to insert algorithms on Verilog language to Simulink?

 How to insert algorithms on Verilog language to Simulink?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. If you have HDL Verifier, you can cosimulate your design with Simulink using either Cadence Incisive or Mentor Graphics ModelSim. You will of course need one or the other of the HDL simulators.   The high-level overview is that you create a HDL cosimulation block in Simulink that has the same interface as your top-level Verilog code. Simulink then executes its simulation, calling the HDL simulator each time the cosimulation block is scheduled to execute. SEE COMPLETE ANSWER CLICK THE LINK https://www.matlabsolutions.com/resources/how-to-insert-al

Conversion of MATLAB (.m) coding into Verilog HDL

  Dear All   I am doing a project in which i have to convert image encryption MATLAB code into Verilog HDL language code and then implemented it on DE2 Board. I have already searcehd a lot of questions regarding this matter but every one said that you have to write MATLAB code either into Embedded MATLAB code or on Simulink. My question is that is this possible that i write a code in simple MATLAB coding means in .m extension (not on Simulink or in Embedded MATLAB code) and convert it into Verilog HDL Langugae. Because i have only .m extension MATLAB code to convert.   Looking forward for a positive response and thanking all in advance.   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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 cod

How to load multiple file type XDF ?

  Hello,  I have problem load multiple .xdf ? I use code data = pop_loadxdf () but just one file. Please help me, Can I use pop_loadxdf() with multiple file ?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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. Do not change directory just to read a data file. Instead use an absolute/relative filename: cd ('E:\UNDIP MAGISTER ELEKTRO\Thesis UNDIP\Program Thesis'); currentFolder = pwd; EEG = dir('*.xdf'); N = length(EEG) ; for i= 1:N x= EEG(i).name; fullFileName = fullfile(cd, x); raw(i) = load_xdf(fullFileName); end   SEE COMPLETE ANSWER CLICK THE LINK https://www.matlabsolutions.com/resources/how-to-load-multiple-file-

Where can I download the Enterprise License Manager and Admin Guide?

  Where can I download the Enterprise License Manager and Admin Guide?   NOTE:- Matlabsolutions.com  provide latest  MatLab Homework Help,MatLab Assignment Help  ,  Finance 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 Enterprise License Manager and Admin Guide can be downloaded directly from your MathWorks account. Note: Only License Administrators on the Enterprise licenses have the ability to download the Enterprise License Manager.   To do so, follow these steps: Go to the Downloads page and sign in if requested. Select "Get License Manager" under the I WANT TO menu. Click the blue button labeled 'Download for <OS/Platform>" under the Enterprise License Manager section to download the Enterprise License Manager. NOTE