Posts

Global variables in MATLAB GUI?

  I'm working with MATLAB GUI. When I'm trying to access the variable which was defined with the push button, it is not defined in the pop up menu. The variables; it should be set 'global', so it is defined in the whole program. And I can use it in any callback. Do you guys have any idea of how to make the variables 'global'?   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.         Answers:  Wherever a global variable is going to be accessed in your code (say, different script files, functions etc.), it should be declared as such:  global globalVariable; . Eg.:    func...

Matlab, operator A\B

  What is the result of the operation A\B, where A(1, m) and B (1, m)? In the manual it is written: A\B returns a least-squares solution to the system of equations A*x= B. So it means x = inv (A'*A)*A'*B? However, the matrix A'*A is singular... Let us suppose:    A=[1 2 3] B=[6 7 6] A\B 0 0 0 0 0 0 2.0000 2.3333 2.0000 If ve use MLS: C = inv (A'*A) singular matrix C = pinv(A'*A) 0.0051 0.0102 0.0153 0.0102 0.0204 0.0306 0.0153 0.0306 0.0459 D= C*A'*B 0.4286 0.5000 0.4286 0.8571 1.0000 0.8571 1.2857 1.5000 1.2857 So results A\B and inv (A'*A)*A'*B are different...   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%...

How to mark a point in a MATLAB plot?

  I have this plot  I need to make a straight  vertical  line at a point on x axis that the  user enters  and  show the coordinates of the intersection  of that vertical line with my plot. How can this be done in MATLAB? for example:  the user enters 1020 then a straight vertical line will be drawn at 1020 that meets the plot at some point and the coordinates of that point will be shown somehow.   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.         Answers:  One way to do this is to use the GINPUT function to graphically select a p...

Convert cell array of cell arrays to matrix of matrices

 I can convert a cell array of matrices to matrix:    >> C={[1,1]; [2,2]; [3,3]}; >> cell2mat(C) ans =      1     1      2     2      3     3 This is OK. But, I want to convert a cell array including other cell arrays to a matrix:    >> C={{1,1}; {2,2}; {3,3}};     >> cell2mat(C) Error using cell2mat (line 53) Cannot support cell arrays containing cell arrays or objects. So, desired output is:    >> mycell2mat({{1,1}; {2,2}; {3,3}}) ans =      1     1      2     2      3     3 How to do this? Edit: I want to do same thing for multidimensional ones also:    >> mycell2mat({{1,1;1,1}; {2,2;2,2}; {3,3;3,3}}) ans(:,:,1) =      1     1      1     1 ans(:,:,2) = ...

How can I set subplot size in MATLAB figure?

  I often need to plot 10 images together, but using this code results in small images :    img = rand(400,600); for i=1:10 subplot(2,5,i); imshow(img); title(['Image ' int2str(i)]); end As you can see, the images do not use all available space in the screen. How can I increase the size, or decrease the padding/margin between them?  Thanks for any help.   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.     Answers:  I don't believe there is an easy way to do it. There are two options: First, use the position part of the subplot:    >> subplot(2,5, i, [l, b,...

Convert MATLAB char array to string

  Starting with the MATLAB char array, A:    A(1,1) = 'A' A(1,2) = 'P' A(1,3) = 'R' A(2,1) = 'M' A(2,2) = 'A' A(2,3) = 'Y' How can this be converted to a cell of strings, B, such that:    B{1} = 'APR' B{2} = 'MAY' Edit: A is a cell and using the function cellstr gives the error    Error using cellstr (line 23) S must be 2-D. 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.       Answers:  Use the following function: http://www.mathworks.com/help/matlab/ref/cellstr.html    >> B = cellstr(A) B = SEE COMPLETE ANSWER CLICK THE LINK      ...

how do you do symbolic differentiation on function handle?

  Say if i define the following:    g = @(x) x/sqrt(x^2+1) How do i get the derivative function for g, which i can then use to evaluate at different points? I tried the symbolic math toolkit, and tried the following:    >> syms x >> f = x/sqrt(x^2+1) f = x/(x^2 + 1)^(1/2) >> diff(f) ans = 1/(x^2 + 1)^(1/2) - x^2/(x^2 + 1)^(3/2) However, i cannot figure out how to turn this into a function handle/evaluate at different points. However, i prefer doing differentiation on function_handle. Thank you very much!   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.   ...