Sources on this Page

> Headlines by Category

 Home / Science / Mathematics

You are using the plain HTML view, switch to advanced view for a more complete experience.


A tabbed figure class to support navigating large data sets with many figures. The class currently supports a tabbed figure with each tab containing multiple plots, tables, and control panels that can be selected using the plot selection list. An example showing some of the features is included.

Hyperspectral unmixing and denoising

Thank you for downloading our code for hyperspectral unmixing and denoising.
What this code do:
This code demonstrates Hyperspectral unmixing algorithm when the image is contaminated by mixed noise.
This code also reduces noise. Noise can include line strips, Gaussian noise, and impulse noise.
It solves following optimization problem :
 min_A,S ||Y-MA-S||_F^2 + lamda1*||Dh*A'||_2,1 + lambda1 *||Dv*A'||_1 + lamda2 ||S||_1 + lambda3 ||A||_{2,1}
 M : mixing matrix. It is the matrix containing spectral signatures of endmembers;
 Y : Noisy hyperspectral image. This is the image sent to the ​unmixing algorithm.
 A : Abundance matrix.
 S : sparse noise. It represents impulse noise as well as line strips.
Dh, Dv : Two-dimensional horizontal and vertical finite difference operators.
Reference Paper

Hyperspectral Unmixing in the Presence of Mixed Noise using Joint-Sparsity and Total-Variation
 by Hemant Kumar Aggarwal, Angshul Majumdar, in IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing (JSTARS), 2016
IEEExplore link : http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=7414394

Paper PDF is available from author's homepage for academic/personal use only.
Homepage link : https://www.iiitd.edu.in/~hemanta/

How to Run this code:

Put both the files in the same folder and just run the "demo.m" file.

The code runs for around 10 seconds. After that, it shows five original abundance maps as well as
reconstructed abundance maps.

It will also show original image, noisy image and denoised image in the output.

It also gives PSNR values for the denoised image as well as reconstructed abundance maps.

File Description :

demo.m : Simply run this file to see how the code works. It contains all the code.
abundance.mat : This file contains ground-truth abundance maps.
ReadMe.txt : This file

Put both the files in the same folder and then run the demo code.

Contact Information:

This code is released just to promote reproducible research and is not very robust.
If you face difficulty in running this code, then please feel free to contact us.

Contact Name : Hemant Kumar Aggarwal
Email : jnu.hemant@gmail.com

Re: Script output help with saving

Thanks for the reply.
Ideally, I would like it to be saved as text.
I think dlmwrite is the best option.

I need help about power signal of base station Base transceiver station.
code and function
Re: impoly, imrect, imellipse breaks uiwait
José Ignacio Orlando" <ignaciorlando@gmail.com> wrote in message <kjne0n$9bu$1@newscl01ah.mathworks.com>...
> I use waitfor as Francois Anquez recommends, but I get the next error message:
> Attempt to reference field of non-structure array.
> Error in trainingSetSelection3dgui>trainingSetSelection3dgui_OutputFcn (line 132)
> varargout{1} = handles.voi;
> Error in gui_mainfcn (line 263)
> [varargout{1:nargout}] = feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);
> Error in trainingSetSelection3dgui (line 40)
> [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
> Does anyone know how to solve it?

I don't know and I have the same problem.

I create a guide figure and run uiwait() to pause the execution of the parent figure. After I have done everything I wanted with the child figure (i.e. gathered all the data from an image), I uiresume().

I tried to run imfreehand from a button callback, but it somewhere inside calls uiresume() and kills the figure.

Any suggestions will be appreciated.

Image processing

Re: Finding roots from bessel functions
Hello all,

I came across this post while looking for a solution to a similar problem. I also needed to find multiple roots to a nonlinear equation composed of Bessel functions, F(x) = 0.

I solved my problem by writing a function as below. The function:
* First identifies the 'approximate' locations of roots by evaluating F(x) on a sufficiently fine regular grid of x and searching for sign changes across x.
* Disects the x-domain into non-overlapping sub-intervals, each containing one and only one root.
* Finally it runs 'fzero' on each sub-interval to determine the precise values of roots. This eliminates the guess work associated with initial values

The function will return as many roots as needed depending on the upper bound of the initial grid x. The roots will be the smallest unique roots returned in ascending order.

Note that there has to be a sign change around each root for this to work. Fortunately this was always the case for my problem.

Also the variables were defined according to my specific problem but the function itself can easily be adapted to other problems. I hope it will be useful to those who are looking for a solution to a similar problem.


function alpha_n = calculate_alpha_roots(nus)
%CALCULATE_ALPHA_ROOTS calculates and returns the roots of a specific
%nonlinear equation composed of bessel functions and is parameterized by
%the input parameter, 'nus'.
% nus: parameter in function 'func'
% alpha_n: The smallest 'N_roots_returned' many roots of equation
% 'func = 0'
N_roots_returned = 256;

% Define Bessel functions:
J0 = @(z)(besselj(0,z));
J1 = @(z)(besselj(1,z));

% Characteristic equation (func(x)= 0) for which we are seeking the
% roots x.
func = @(x)(J1(x) - (1 - nus).*x .*J0(x)./(1 - 2.* nus));

% Find approximate locations of the roots, exploiting the fact that each
% root is associated with a change of sign.

% Computational grid for determination of approximate locations of roots:
x = 0:0.1:1000; % The interval needs to be large enough to satisfy
                % N_roots_found >= N_roots_returned
F = func(x);
SF = sign(F);
% Difference of signs between successive grid points
DSF = (SF(2:end) - SF(1:end-1));
% If there is a sign change, then there is a root in the vicinity.
approximate_roots = x(abs(DSF)>0);
approximate_roots = sort(approximate_roots(:));

% Disect the domain into regions containing one and only one root:
bounds = 0.5*(approximate_roots(1:end-1)+approximate_roots(2:end));
bounds(end+1) = max(x);
N_roots_found = numel(approximate_roots);
roots = zeros(N_roots_found,1);

% Find precise locations of the roots by running fzero within each region.
% We know the first root: x = 0;
for i = 2:N_roots_found
    lb = bounds(i-1);
    ub = bounds(i);
    roots(i) = fzero(func, [lb ub]);

alpha_n = roots(1:N_roots_returned);

end % function

"cevik1404" wrote in message <n24ski$4js$1@newscl01ah.mathworks.com>...
> "Robi" wrote in message <gu32me$lg4$1@fred.mathworks.com>...
> > Hi
> > I am a new user of Matlab and new in this site. I am trying to find a number of roots or multiple roots (i.e., x in the following equation) from a non-linear equation of bessel functions which is given below:
> >
> > x*J'(m,x*r)+H*J(m,x*r)=0
> > where
> > J'(m,x*r) is the first derivative of Bessel function J(m,x*r)
> > m= degree and r=ro (say, known) and H is a known constant
> >
> > Please, help me to figure this out.
> >
> > thanks
> >
> Hi Robi
> I am also trying to find roots of bessel function like your quest?ion (x*J'(m,x*r)+H*J(m,x*r)=0
> ) could you help me about it .. ? am new at matlab ..


Re: Script output help with saving
On 06/25/2016 1:44 PM, George Pamboris wrote:

> The problem I am facing is that I want the script to save the above
> variables by using the following function:
> [filename, pathname] = uiputfile('*.txt','Name the outputfile with the
> tracked data');
> However, it does not save anything. Could anyone help me please with the
> saving part?

No, per the documentation, it simply returns a file and path of the
user's creation/choice; it's up to the program to use that and do the work.

So, the question is, _how_ do you want the data save? .mat file, some
particular form of text file, .csv, Excel spreadsheet(ugh!), ...???


help iofun

There are a number of functions to perform such depending on your

  File import/export functions.
     dlmwrite - Write ASCII delimited file.
     csvwrite - Write a comma separated value file.

   Spreadsheet support.
     xlswrite - Stores numeric array or cell array in Excel workbook.

   Formatted file I/O.
     fscanf - Read formatted data from file.

   Binary file I/O.
     fwrite - Write binary data to file.

Then, there's the Matlab-specific SAVE for .mat files

help general

   Managing the workspace.
     load - Load workspace variables from disk.
     save - Save workspace variables to disk.

So, which of those seems most appropriate to your desires?

image processing
hello, i am trying to do a Gaussian filtering on a smartphone image of myself by running the following code

cm1 = rgb2gray(cm);
cf=fftshift(fft2(c));%fourier transforms the image
cg1=c.*g1;5filtering the image
cgi1=ifft2(cg1);%inverse ifft

but i get this error
??? Error using ==> times
Integers can only be combined with integers of the same class, or scalar doubles.

i have converted the image from true colour to gray.

Below code using matlab image cameraman works perfectly well
cm1 = rgb2gray(cm);
cf=fftshift(fft2(c));%fourier transforms the image
cg1=c.*g1;5filtering the image
cgi1=ifft2(cg1);%inverse ifft

I will appreciate your responses
Post Selected Items to:

Showing 10 items of about 1100

home  •   advertising  •   terms of service  •   privacy  •   about us  •   contact us  •   press release design by Popshop •   Official PR partner PRNews.io •   © 1999-2016 NewsKnowledge