https://es.mathworks.com/matlabcentral/newsreader/most_recent_feed
MATLAB Central Newsreader Recent Posts
Most Recent Posts
enus
©19942017 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
https://es.mathworks.com/images/membrane_icon.gif

Mon, 26 Jun 2017 16:03:08 +0000
filter bank
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348904#954839
Jing H
I have ten images and a filter bank with 38 filters, i want to filter each of these ten images by all these 38 filters, it means i will get 380 filtered images. how can i save these 380 image datas in matlab. here is part of my codes: <br>
<br>
function [ filterresponse ] = filter_response( )<br>
<br>
addpath('../Filter Bank');<br>
im = {};<br>
dis = dir('C:\Users\jing3\Documents\MATLAB\ActiveModels_version7\Fotos\train*jpg');<br>
for i=1:length(dis)<br>
path = strcat('C:\Users\jing3\Documents\MATLAB\ActiveModels_version7\Fotos\',dis(i).name);<br>
im{i}=imread(path);<br>
imgray{i}=rgb2gray(im{i});<br>
figure,imshow(imgray{i});<br>
end<br>
<br>
filters = makeRFSfilters;<br>
<br>
filterresponse = zeros(size(imgray{i},1),size(imgray{i},2),size(filters,3));<br>
<br>
for k=1:size(filters,3)<br>
<br>
filterresponse(:,:,k) = conv2(double(imgray{i}),filters(:,:,k),'same');<br>
<br>
<br>
end;<br>
<br>
% imshow(grayim);<br>
%figure, imshow(filterresponse(:,:,k));<br>
end

Mon, 26 Jun 2017 14:27:03 +0000
Re: How can I set a timeout for slow executing codes?
https://es.mathworks.com/matlabcentral/newsreader/view_thread/119565#954838
Kevin Doherty
Hi,<br>
<br>
Other posters had some good points about picking different solvers, supplying Jacobian, etc. but I thought I would add a few things. <br>
<br>
First of all, supplying time as [t_start; t_interval; t_end] will not help. Matlab still picks its own points for evaluation, it merely returns the function at these points. The problem is down to numerical instability. <br>
<br>
I would probably do it by using the event function as Alexey suggest, although an output function should also work. In the case of an event function, setting a time limit is a good idea but in my experience it is sometimes better (maybe depends on problem) to also set limits for the variables. For example, if you know your variable values are strictly positive, do something like <br>
<br>
function my_integration(trange, ic)<br>
<br>
options = odeset('Events', @my_event_fcn);<br>
start_time = tic;<br>
[t, y, te, ye, ie] = ode45(@my_fcn, trange, ic, options);<br>
<br>
function [value, isterminal, direction] = my_event_fcn(t, y)<br>
<br>
t_limit = 10; % set a time limit (in seconds)<br>
value1 = t_limit  toc(start_time);<br>
value2 = min(y);<br>
<br>
value = min([value1, value2]); <br>
<br>
isterminal = 1;<br>
direction = 0;<br>
<br>
end<br>
end<br>
<br>
Also, Bob suggested taking the output of the solver and supplying it back to itself. The idea is good to see what is going on with your problem but a more efficient way is to use the debugger. <br>
<br>
Hope these things help anyone with this issue

Mon, 26 Jun 2017 13:28:04 +0000
Re: Add gaussian noise
https://es.mathworks.com/matlabcentral/newsreader/view_thread/295673#954837
sajjad nasiri
"mayan mayan" wrote in message <ib18cr$ekl$1@fred.mathworks.com>...<br>
> "Sean " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <ib137u$sqp$1@fred.mathworks.com>...<br>
> > "mayan mayan" <mayan_n@yahoo.com> wrote in message <ib12dj$4fg$1@fred.mathworks.com>...<br>
> > > I am trying add Gaussian noise to image with 10db using i imnoise(I,'gaussian',0,1) function in matlap.<br>
> > > Please could anyone help me to do this ? <br>
> > <br>
> > So what's the problem?<br>
> Hi <br>
> I have to add 10db. please can you tell me how to use this function to set '10db'<br>
<br>
Hi.<br>
<br>
clc; close all; clear;<br>
image=im2double(imread('cameraman.tif'));<br>
figure,imshow(image),title('image')<br>
<br>
for i=1:size(image,1)<br>
image(i,:) = awgn(image(i,:), 20);<br>
end<br>
figure,imshow(image),title('noisy image')

Mon, 26 Jun 2017 13:13:05 +0000
Problem with GUIDE
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348903#954836
Jorge Sanchez
Hi all, im making a program to learn how to use MATLAB GUIDE. After reading couple manuals and watching some videos, i have this problem.<br>
<br>
From the file '.m' of the GUIDE i call an script that controls different functions, one of them is print in the graph that i have on my GUI using this code:<br>
<br>
.....<br>
axis(handles.figura1);<br>
pcolor(W_pcolor );<br>
.....<br>
<br>
The axes TAG is figura1. <br>
<br>
The problem is that it doenst recognise the 'axis(handles.figure1);' as a variable neither as an structure, and says that is undefined. Acording to my research when i use handles.TAG i'm already setting the plotting place<br>
<br>
<br>
I hope i've explained mysef, cuz i dont even know what problem i have.<br>
<br>
Regards.

Mon, 26 Jun 2017 13:07:46 +0000
Re: fmincon optimization
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348896#954835
Alan Weiss
On 6/24/2017 10:01 PM, Tamal Roy wrote:<br>
*SNIP*<br>
> objective function is :<br>
><br>
> function f = objective(x)<br>
> %Electricity price for each hour.<br>
> %Data extracted from the Central NY LMBP ($/MWHr) for 5/4/2013 Source:NYISO<br>
> LBMP = [33.11, 31.79, 28.60, 28.01, 27.73, 28.03, 26.69, 29.09,<br>
> 31.43,33.20, 33.74,34.05, 34, 33.99, 33.64, 33.87, 34.25, 34.94, 34.59,<br>
> 35.69, 37.56,37.60, 33.41, 32.59];<br>
> price = LBMP.*0.000001.*0.5;<br>
> f = sum(x*price');<br>
*SNIP*<br>
> x0=zeros(6,10,24);<br>
*SNIP*<br>
><br>
> but this optimization does not work... it shows this error:<br>
><br>
> Error using * Inputs must be 2D, or at least one input must be scalar.<br>
> To compute elementwise TIMES, use TIMES (.*) instead.<br>
><br>
> Error in objective (line 7)<br>
> f = sum(x*price');<br>
><br>
> Error in fmincon (line 534)<br>
> initVals.f = feval(funfcn{3},X,varargin{:});<br>
><br>
> Error in sche_new (line 21)<br>
> [x,f]=fmincon(@objective,x0,[],[],[],[],x_a_min_1(appnum,:,:),x_a_max_1(appnum,:,:),@(x)constraint_class1(x,B_a_1(app_num),S_a_1(app_num),F_a_1(app_num),L_a_1(app_num)),options);<br>
><br>
><br>
> Caused by:<br>
> Failure in initial usersupplied objective function evaluation.<br>
> FMINCON cannot continue.<br>
<br>
I suggest that you learn to use the debugger. See <br>
https://www.mathworks.com/help/matlab/debuggingcode.html<br>
<br>
Meantime, the error message is clear. Your x0 is 6by10by24, so your <br>
x variable has that same size. You cannot multiply x*price' because x is <br>
not a 2D matrix.<br>
<br>
Alan Weiss<br>
MATLAB mathematical toolbox documentation

Mon, 26 Jun 2017 12:44:05 +0000
Want to make a circle of ones in a zeros matrix
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348902#954834
Daniel Gray
Hi,<br>
<br>
I have a zeros matrix and would like to have a circle of ones in the matrix.<br>
Ideally, I would like to have a situation where half of the matrix is this circle of ones.<br>
<br>
Thanks in advance!!

Mon, 26 Jun 2017 12:30:07 +0000
Re: How to analyse the results of training of neural network ?
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348806#954833
afef
<br>
> <br>
> I don't understand why you are so thoroughly confused.<br>
> <br>
> How many of my 65 NEWSGROUP PATTERNET THREADS have you perused?<br>
<br>
<br>
Sorry i know that i'm so confused because i tried all what i read from your NEWSGROUP PATTERNET but i don't get thet results that i should have

Mon, 26 Jun 2017 12:02:04 +0000
Matlab's RectangularPulse Function is too slow : help !
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348901#954832
Michail Raptakis
Hi,<br>
<br>
I work currently on a Pattern Recognition project and i need to use the rectangular pulse function in order to create 9 probability density functions using Parzen windows. That means i will have to add many many rect functions to create the pdfs i need. The way I currently do it produces correct results but is incredibly slow. For example 20 iterations (or 20 samples) take 1 and a half minute and I will have to do thousands of iterations. I currently use Matlab's RectangularPulse function in a fairly simple manner and cannot understand what is taking so long. The gaussmf function on the other hand finishes insanely quickly even for thousands of samples, and I use it in the exact same way. Here is a small fraction of the code: <br>
<br>
for i = 1:number_of_samples<br>
<br>
pdf3 = rectangularPulse((3/2) + sample, (3/2) + sample, x);<br>
pdf5 = . . . <br>
pdf10 = . . <br>
.<br>
<br>
if class == 1 <br>
pdf_1_3 = pdf_1_3 + pdf3;<br>
pdf_1_5 = pdf_1_5 + pdf5;<br>
.<br>
.<br>
.<br>
elseif class == 2<br>
. . .<br>
elseif class == 3<br>
. . .<br>
end<br>
<br>
end <br>
<br>
normalize(pdfs....);<br>
<br>
plot(x,pdf_1_3, 'LineWidth', 2.4, 'Color', 'r'); <br>
plot(x,pdf_1_5, . . . <br>
...etc.<br>
<br>
I am asking if anyone knows how can i write the rect function so that I can give it a window width and sample(center) and return the same as Matlab does, working far more efficiently. I am in a hurry since the deadline is soon so any help is incredibly appreciated. <br>
<br>
Thanks in advance, <br>
<br>
Mike.

Mon, 26 Jun 2017 11:43:08 +0000
Matlab Function Call Problem
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348900#954831
Sujoy Paul
I can see functions such as imresize under C:\Program Files\MATLAB\R2015a\toolbox\images\images but when I call it in command window, it is showing error: Undefined function 'imresize' for input arguments of type 'uint8'.<br>
<br>
Any idea what is going on ?

Mon, 26 Jun 2017 11:01:09 +0000
Re: Determinant Trusses & MATLAB
https://es.mathworks.com/matlabcentral/newsreader/view_thread/237163#954830
David Lane
It is incredibly likely you have no need for the answer to this question anymore Damien, however I was and came across this youtube video of someone using matrices to solve a truss problem. It is an entirely differant truss then you had to work with and an entirely different truss than I had to work with however it served as a fantastic guide to helping understand how to calculate for my truss. And indeed any truss for that matter. <br>
<br>
https://www.youtube.com/watch?v=uvHGCZO1agM<br>
<br>
Due to the nature of the MATLAB forums, it will not show up as a link no matter what I do, you will need to copy and paste it.

Mon, 26 Jun 2017 10:53:04 +0000
Re: OPENLOOP NARXNET FOR THE PH_DATASET
https://es.mathworks.com/matlabcentral/newsreader/view_thread/346212#954829
Marco Illiano
Hello Greg,<br>
I'm working on data from a cosmic ray detector. I have about 11 explanatory variables and it is difficult to produce a unique model for ID. <br>
From ACP analisys you can see that the weather and seismic variables have good relations in the short term with the dependent variable. The variables relate to solar activity, have a poorer relationship.<br>
But from the studies it is well known that the relationship is visible over longer periods than the one in question: in the last year (since the detector is in operation), solar activity was quite contained: Cross correlation and correlation with the dependent variable does not show significant values for solar activity variables.<br>
<br>
So I'm trying to develop two networks for the short (daily basis) and long term (on a monthly basis).<br>
<br>
Now I'm starting from your program to optimize the number of hidden nodes. Just a question about: <br>
Why did you set MSEgoal so low (0.001) when default "trainlm" will always stop train on validation data??<br>
Do you know if exist pruning algorithm of weights in Matlab??<br>
<br>
<br>
<br>
"Greg Heath" wrote in message <oij0qm$hqa$1@newscl01ah.mathworks.com>...<br>
> "Marco Illiano" wrote in message <ofmld1$5ig$1@newscl01ah.mathworks.com>...<br>
> > hello Greg,<br>
> > you have chosen ID = 0:26 for the delay of the first and second input but in the first crosscollelation the first 12 values are not significant.<br>
> > These 12 nonsignificant delays will be taken by the narx function:<br>
> > y (t) = f (y (t1), y (t2), ..., y (tn) y), U (t1), u (t2), ..., u (tnu))<br>
> > Is it true??<br>
> <br>
> SORRY FOR THE DELAYED RESPONSE ( : >( )<br>
> <br>
> The subsets with the smallest significant feedback delays were<br>
> <br>
> input 1 13 : 26<br>
> input 2 0 : 26<br>
> <br>
> However NARXNET (and TIMEDELAYNET) can only use one delay <br>
> subset for all of the inputs.<br>
> <br>
> I arbitrarily chose [ 0 : 26 ]. If you wish to have some fun you can <br>
> try [ 13 : 26 ] and then optimize [ d1:26] .<br>
> <br>
> If you do please post the results.<br>
> <br>
> Greg

Mon, 26 Jun 2017 09:30:08 +0000
Streamline from data file
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348899#954828
zack bob
Hay,<br>
I have a data file with 4 column (x,y,u,v), where (x,y) coordinates represent my meshgrid, and u v are respectively the velocity in the xdirection and ydirection.<br>
Using Matlab streamline function I'm trying to reproduce the streamline of my data, but I'm have this error : U,V must all be size 2x2 or greater.

Mon, 26 Jun 2017 07:18:04 +0000
Re: Multi Scale Retinex with Color Restoration ( MSRCR)
https://es.mathworks.com/matlabcentral/newsreader/view_thread/313065#954827
bindhu a
this is not the code for multi scale Retinex, multiscale retinex has neighbourhood weights. which this code does not have.

Mon, 26 Jun 2017 01:29:28 +0000
Re: Openfig('*.fig','reuse') opens wrong figure
https://es.mathworks.com/matlabcentral/newsreader/view_thread/167240#954826
Loren Shure
"edoardo lauri" wrote in message <br>
news:oij0qo$hqr$1@newscl01ah.mathworks.com...<br>
<br>
I have exactly the same problem with Matlab 2014.<br>
<br>
If i do openfig(file1,'reuse') and then openfig(file2,'reuse') , I get only <br>
file1 opened.<br>
<br>
does anybody know how to solve the problem?<br>
<br>
thanks<br>
<br>
<br>
<br>
<br>
"Bobane" wrote in message <fti8l9$por$1@fred.mathworks.com>...<br>
> Hi,<br>
> I am having a problem using the 'openfig' function.I have a<br>
> number of GUI windows in an application. I occasionally need<br>
> to keep several GUIs open, but only want one instance of<br>
> each GUI open. So I use openfig('gui1.fig','reuse'). However<br>
> if another GUI with a different name is already open, this<br>
> command sometimes brings up the already open GUI window and<br>
> not the specified 'gui1.fig'. It is as if openfig() is<br>
> confusing the names of the *.fig files. I have opened<br>
> 'openfig.m' and looked at it, and it seems to be flipping<br>
> the filenames (fliplr) and performing some operation on<br>
> this. But even so, I don't understand how two very different<br>
> *.fig filenames can be interchanged. Unless there is<br>
> something else happening?. Thanks for any suggestions.<br>
><br>
> Bobane.<br>
<br>
Look at the help for openfig: <br>
https://www.mathworks.com/help/matlab/ref/openfig.html<br>
<br>
remove the 2nd input argument from your calls to openfig and I think you'll <br>
get what you wanted.<br>
<br>
Loren<br>
<br>
<a href="http://blogs.mathworks.com/loren">http://blogs.mathworks.com/loren</a>

Mon, 26 Jun 2017 01:22:27 +0000
Re: Column Splitter
https://es.mathworks.com/matlabcentral/newsreader/view_thread/348874#954825
Loren Shure
"Santiago Varas (ME)" wrote in message <br>
news:oij0qr$hrc$1@newscl01ah.mathworks.com...<br>
<br>
Hello,<br>
I have a very long (half million data points) column vector measuring engine <br>
RPMs at 1Hz. Every time the engine turns on, telemetry is recorded and <br>
stored. I need to write a script that will split this column into separate <br>
smaller columns for every time the engine is turned on, so I can data mine <br>
each separate engine run. Any idea how to go about this? I'm very new to <br>
Matlab.<br>
<br>
You need to tell us how you know you have a new recording in the file...<br>
<br>
<br>
Loren<br>
<br>
<a href="http://blogs.mathworks.com/loren">http://blogs.mathworks.com/loren</a>