Skip to main content

Posts

Showing posts from November, 2023

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

Finding the first instance of a value in an array

  I have an array with many rows and many columns. I want to search the array row by row, find the first instance of a value that is above 170 (yellow cells below) and then store the colum index it was found in (green cells below) in a new array. If there are no values above 170, then return 0 as the index. This should explain it:   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. YourArray = randi([100 180], 10, 20) YourArray = 10×20 110 163 114 129 160 127 126 132 104 147 134 159 169 117 170 117 153 127 180 165 103 137 155 141 159 129 137 162 172 109 159 160 134 156 166 110 17

Find function misbehaves when Indexing into array

  I have a function which searches an array for the first value which is below a given tolerance. First, it creates a logic array using the input and a "less than" condition. Then it finds the index of the first instance of "True" in the LogicArray using the find function. If no "True" value could be found, it sets the index to be the last value in the array (in this case, 125). Then it uses the found index value to return a corresponding array value.    function [FindIndex, RxComplete] = IndexCheck(x,y) Tolerance = 100; LogicArray = x < Tolerance; FindIndex = find(LogicArray,1,'first'); if isempty(FindIndex) FindIndex = 125; end RxComplete = y(FindIndex,1); end The function is then applied to a cell array using cellfun. [Index_output, Array_output] = cellfun(@IndexCheck, x, y, 'UniformOutput',false); The code works for the above application, but it mesbehaves when I try to only search certain elements of my input array. For example,

How do I prompt for a variable in one script and use it in another

  My first script which prompts the user is as follows   %this main script calls to one main function(isPalindrome) with a subfunction(removeNonAlpha) %this script prompts the user for a character vector to test for being a % palindrome fprintf('A palindrome is a word, phrase, or sequence that reads the same backward as forward\n') str=input('Enter text to test for palindrome:','s'); welp=isPalindrome; if welp==1 fprintf('Heyy!! %s is a palindrome :) ',str) else fprintf('Dang :( %s is not a palindrome ',str) end The function that the first script calls is as follows %this function tests whether a character vector is a palindrome function Welp=isPalindrome(~) strrevised=removeNonAlpha(str); if strrevised==fliplr(strrevised) Welp=1; else Welp=0; end end function strrevised=removeNonAlpha(str) %this function takes in a string and revises it to remove blanks and to %remove numbers ie take only alpha characters str2=isletter(s

Why is my PEAK-System CAN device not detected in Vehicle Network Toolbox?

  Why isn't my PEAK-System device detected by the "canChannelList" or "canHWInfo" functions in MATLAB, or using the CAN Configuration / CAN Receive / CAN Transmit blocks in 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. To have the PEAK-System CAN device detected in MATLAB or Simulink you need to install the vendor device drivers and PCAN-Basic API DLL as described below.   The PEAK-System device would not be detected if: The vendor PEAK-System CAN device drivers are not installed or are not configured properly during installation, or  The vendor drivers installed the 32-bit version of PCAN-Basic API DLL instead of

How to make a open switch fault using ePWM block(Texas instruments c2000)?

  I'm trying to make open switch fault situation (or the duty cycle of the high side switch to be 0 while not effects the low side one.) . And I'm using a EPWM block from texas instruments c2000 add-on. I want a high side switch to be opened not the low side one too. I did 1)  continuous software force  to control the high side switch(ePWM-A)..... but it's the highest priority signal that makes ePWM-B signal changed.   Is there any way I could solve this problem?   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. Hi, I understand that you want a high side switch to be opened not the low side one in a 'EPWM' block from Texas Instrumen

MatLab App Design - how to use default value for Edit Field function?

  Hello,   I have an Edit Field box on the Design view and I opened a callback in the Code View. There is a default value in the Edit Field box that I would like to be used automatically when a user runs the app. I have this: % Value changed function: LengthEditField function LengthEditFieldValueChanged(app, event) app.L = app.LengthEditField.Value; if isempty(app.L) new_value = 3; % set default value to 3 end app.L=new_value; end But when I use this variable in an equation, it tells me that its "empty (0x0) double".   How do I get it to display a value of 3 for example ?   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

How to set to 'none' the UnitsInconsistencyMsg

  Hi, I have defined some unit of measure in bus objects, using the bus editor, but whenever I run a simulation I get the following message:   Warning: The units 'm3' specified on block 'Controls/Engine Control Module/ECM model variant/ Internal ECM' are not defined in the Simulink   unit database. Investigate <b>52 similar inconsistencies</b> on Model Advisor Report.   If you cannot use a unit that exists in the database, consider suppressing all units inconsistency warnings by setting the configuration parameter   <sldiag objui="configset" objparam="UnitsInconsistencyMsg">'Units inconsistency messages'</sldiag> to 'none'.   I know this is the wrong way to define m3, and the correct way is m*m*m, but I need to define it like this to have another software correctly reading the unit when importing the simulation outputs from Simulink.   I'm using MATLAB R2017b and I could not find a way to set the Units inco

Genetic Algorithm : Lower and Upper Bounds

  How to choose the VarMin (Lower Bound of decision Variables) and VarMax (Upper Bound of Variables) of any problem when using the genetic algorithm optimization ? What its effect on improvement ?   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 handling of bounds in the case of the use of ga is very well described.   Essentially, ga ensures that the initial population complies with the restrictions on bounds. Another point is compliance with the restrictions over the term of the algorithm, if certain conditions are met.   To define them use for example: lb = [-1 0 0 -inf]; ub = [Inf 1 1 0]; In the example above you have 4 decision variables x1...

How can I save a figure within app designer?

  I've developed an application using the new App Designer. I'd like to have users be able to click a button and save a figure to a .fig file, or some other image format.   function ButtonSaveFigureButtonPushed(app) newfigure = figure; copyobj(app.UIAxesAP, newfigure); hgsave(newfigure, 'testFIgure.fig'); end But that gave me the error... Error using matlab.ui.control.UIAxes/copyElement (line 1219) Functionality not supported with UIAxes. For more information, see Graphics Support in App Designer.,/pre> What's the best way to go about 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. I sp

How can we model this equation in simulink dx/dy

  How can we model this equation in simulink dx/dy + x + y = 1 where x is the input and y is the output?   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. Re-write as     dx/dy = 1 - x - y % y is your independent variable, sort of "t" therefore dy/dx = 1/(1 - x - y) Then, from left to right (in your Simulink block diagram) you have a summation block, adding up the right hand side, and taking the reciprocal value the output goes into an integrator block that outputs   y , which is the solution and also feeds back into the summation block SEE COMPLETE ANSWER CLICK THE LINK https://www.matlabsolutions.com/resources/how-can-we-model-this-equat