https://uk.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://uk.mathworks.com/images/membrane_icon.gif

Thu, 30 Mar 2017 08:06:03 +0000
Directivity of Dodecahedron Loudspeaker
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348020#952781
ICHA ADY RISTANTI
Hi, good afternoon.<br>
Firstly, I'd like to introduce myself, Icha as undergraduate students.<br>
In this forum, i want to asking about directivity of Dodecahedron loudspeaker.<br>
I have a data or polar pattern of one driver loudspeaker, and I want to get a directivity of dodecahedron loudspeaker with Matlab Simulation.<br>
Anyone can help me? Maybe, give me a script or explain how to simulate it.<br>
Thank you very much.

Thu, 30 Mar 2017 07:45:03 +0000
Reference to a cleared variable
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348019#952780
vincent mbuvi
Reference to a cleared variable Pout.<br>
<br>
Error in HW_2_Problem_2_b_i_m (line 56)<br>
plot (Pout(:,1),Pout(:,2))<br>
<br>
<br>
Am getting the above error massage when I try to plot a graph through a simulink model. <br>
Am initiating the model though an mfile from where the "plot (Pout(:,1),Pout(:,2))" code line 56 is located.<br>
In simulink Pout is a scope and when I double click on it am able to view the transient graph generated. The simulink model sims to load correctly. This error is preventing a graph from being generated through the workspace. <br>
<br>
The commands "clear all", "close all" and "clc" are not the problem as I have other programs with the same output running without error and generating the plot.<br>
<br>
Thanks

Thu, 30 Mar 2017 07:41:03 +0000
Re: Fast Removal of Array values
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348016#952779
Bruno Luong
It is not recommend to grow or skrink arrays especially within a loop since it is always costly and there is no faster way.<br>
<br>
In your case what you need is reorganize your code and use some kind of circular buffer to keep last p/q data.<br>
<br>
Bruno

Thu, 30 Mar 2017 06:39:01 +0000
Re: need help
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348018#952778
Nasser M. Abbasi
On 3/30/2017 1:26 AM, nir margalit wrote:<br>
> in need to create a 97 length vector with randomly 1:8 numbers<br>
> for example:<br>
> 1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
><br>
> THANKS<br>
><br>
<br>
<br>
one possibility might be<br>
<br>
randi(8,1,97)<br>
<br>
doc randi for more info<br>
<br>
Nasser

Thu, 30 Mar 2017 06:26:04 +0000
need help
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348018#952777
nir margalit
in need to create a 97 length vector with randomly 1:8 numbers <br>
for example:<br>
1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
<br>
THANKS

Thu, 30 Mar 2017 06:24:03 +0000
need help
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348017#952776
nir margalit
in need to create a 97 length vector with randomly 1:8 numbers <br>
for example:<br>
1 7 6 4 4 3 1 5 8 3 2 4 7 8 6 1 2 3 4 5 4 5 6 6 7 2 3 8 ...... n=97<br>
<br>
THANKS

Thu, 30 Mar 2017 06:07:03 +0000
Fast Removal of Array values
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348016#952775
George Hulme
I currently have a loop in a program that calculates the x y and z values for the lorenz attractor, using the euler method, that I have made for a coursework (I cannot use the built in rungakutta based function already in matlab). I have done a profiler report on the program and the loop in the program, specifically the data removal section, takes a very large large amount of time to complete.<br>
<br>
The loop is given below:<br>
j = 1;<br>
for i=1:N<br>
X(j+1) = X(j) + (s*(X(j) + Y(j)))*H;<br>
Y(j+1) = Y(j) + (r*X(j)  Y(j)  X(j)*Z(j))*H;<br>
Z(j+1) = Z(j) + (b*Z(j) + X(j)*Y(j))*H;<br>
<br>
% Cuts out extra data that would otherwise fill memory and slow the<br>
% program significantly at low H values<br>
if mod(i,q) == 0<br>
pop = jq+1:j1;<br>
X(pop) = [];<br>
Y(pop) = [];<br>
Z(pop) = [];<br>
j = j  q + 1;<br>
end<br>
j = j + 1;<br>
end<br>
<br>
My question is: What is the fastest way to remove array elements from a 1xN array where N is an integer greater than 10000000?<br>
<br>
Any help would be greatly appreciated

Thu, 30 Mar 2017 05:57:36 +0000
Re: Shadow Removal Using Entropy minimization
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/262429#952774
bce.anil@gmail.com
On Friday, August 19, 2016 at 7:13:08 PM UTC+5:30, Han Gong wrote:<br>
> See my code here: https://uk.mathworks.com/matlabcentral/fileexchange/52233grahamfinlaysonsilluminationinvariantimage<br>
> <br>
> I believe this is the best implementation. I work with the lead author of the paper.<br>
> <br>
> Cheers,<br>
> Han<br>
> "Sandeep " <sandeepdevasrii@gmail.com> wrote in message <hafchq$bl1$1@fred.mathworks.com>...<br>
> > <br>
> > Hi all,<br>
> > <br>
> > I am trying to implement a shadow removal algorithm in matlab. I follow the paper<br>
> > written by Mr.Graham.Finalyson i.e, "Shadow removal using Entropy minimization".<br>
> > First of all i am trying to get 1D illuminant invariant image by assuming that we<br>
> > know the projection angle. I took some known images from the above mentioned<br>
> > paper so that i know the projection angle and there is no need of entropy calculation.<br>
> > The program which wrote works with some images and seems to be failed with some images. Please help me if some one has some experience with this algorithm. I am appending small part of my matlab code which is written to produce a 1D illumination invariant image.<br>
> > <br>
> > <br>
> > I = imread('file1.tiff');<br>
> > J = im2double(I);<br>
> > <br>
> > R = J(:,:,1);<br>
> > G = J(:,:,2);<br>
> > B = J(:,:,3);<br>
> > <br>
> > [len,wid] = size(R);<br>
> > <br>
> > % Generation of 2D Log Chromaticity Image.<br>
> > for i = 1:len<br>
> > for j = 1:wid<br>
> > if ((R(i,j)*G(i,j)*B(i,j))~= 0)<br>
> > c1(i,j) = R(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > c2(i,j) = G(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > c3(i,j) = B(i,j)/((R(i,j)*G(i,j)*B(i,j))^(1/3));<br>
> > else<br>
> > c1(i,j) = 1;<br>
> > c2(i,j) = 1;<br>
> > c3(i,j) = 1;<br>
> > end<br>
> > end<br>
> > end<br>
> > <br>
> > rho1 = mat2gray(log(c1));<br>
> > rho2 = mat2gray(log(c2));<br>
> > rho3 = mat2gray(log(c3));<br>
> > <br>
> > X1 = mat2gray(rho1*1/(sqrt(2))  rho2*1/(sqrt(2))); %(1/sqrt(2); 1/sqrt(2); 0)<br>
> > X2 = mat2gray(rho1*1/(sqrt(6)) + rho2*1/(sqrt(6))  rho3*2/(sqrt(6))); %(1/sqrt(6); 1/sqrt(6); 2/sqrt(6))<br>
> > <br>
> > theta = 120;<br>
> > <br>
> > InvariantImage = cos(theta*pi/180)*X1 + sin(theta*pi/180)*X2;<br>
> > <br>
> > <br>
> > <br>
> > Thank you all,<br>
> > Sandeep P<br>
<br>
can u provide matlab code for video shadow removal my email id is bce.anil@gmail.com

Thu, 30 Mar 2017 05:31:03 +0000
How to remove lead vocal without losing the bass
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348015#952773
Steven Aldo
Hi, recently I'm working on lead vocal elimination for my thesis.<br>
I tend to do it as simple as it can be done.<br>
Based on this link (https://www.quora.com/AudioEditingWhatisthebestwaytoremovevocalfromasoundtrackusingMATLAB), I have try to code:<br>
<br>
>> [y,fs]=wavread('sekaini2.wav');<br>
>> left=y(:,1);<br>
>> right=y(:,2);<br>
>> wavplay(0.6*(left+(right*1)),fs);<br>
<br>
and the result is, the lead vocal has gone and leave the back vocal, as I hoped to. But using that method, the bass track has also dissapear, which I don't expect to.<br>
What I want is, eliminate the lead vocal while keep the bass remaining in the output.<br>
<br>
Can anyone correct me or give me some suggestions how to do it better? Since I'm new to Matlab.<br>
<br>
Thanks in advance.

Thu, 30 Mar 2017 03:58:04 +0000
Re: Make sparse not adding together elements in v that have duplicate subscripts in i and j, but using the maximum elements
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348010#952772
qiang zhang
Problem fixed. Many thanks!<br>
<br>
"qiang zhang" wrote in message <obhv1r$4g9$1@newscl01ah.mathworks.com>...<br>
> Thank you so much!<br>
> I used <br>
> new_v = accumarray([i(:),j(:)],v(:),[],@max,0,true);<br>
> The new matrix new_v is smaller than the old matrix v. Could you please let me know where I made mistakes?<br>
> Many thanks again!<br>
> <br>
> <br>
> "Bruno Luong" wrote in message <obgdhg$f1q$1@newscl01ah.mathworks.com>...<br>
> > "qiang zhang" wrote in message <obgc87$c36$1@newscl01ah.mathworks.com>...<br>
> > > Hi, when I use<br>
> > > new_v = sparse(i(:),j(:),v(:),m,n);<br>
> > > where i, j and v are 3 matrices, how can I make sparse NOT adding together elements in v that have duplicate subscripts in i and j, but using the largest of the duplicates? Many thanks!<br>
> > <br>
> > Use accumarray with @max as FUN and set issparse option to TRUE

Thu, 30 Mar 2017 03:46:03 +0000
Re: Make sparse not adding together elements in v that have duplicate subscripts in i and j, but using the maximum elements
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348010#952771
qiang zhang
Thank you so much!<br>
I used <br>
new_v = accumarray([i(:),j(:)],v(:),[],@max,0,true);<br>
The new matrix new_v is smaller than the old matrix v. Could you please let me know where I made mistakes?<br>
Many thanks again!<br>
<br>
<br>
"Bruno Luong" wrote in message <obgdhg$f1q$1@newscl01ah.mathworks.com>...<br>
> "qiang zhang" wrote in message <obgc87$c36$1@newscl01ah.mathworks.com>...<br>
> > Hi, when I use<br>
> > new_v = sparse(i(:),j(:),v(:),m,n);<br>
> > where i, j and v are 3 matrices, how can I make sparse NOT adding together elements in v that have duplicate subscripts in i and j, but using the largest of the duplicates? Many thanks!<br>
> <br>
> Use accumarray with @max as FUN and set issparse option to TRUE

Thu, 30 Mar 2017 01:10:03 +0000
Re: iris detection
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/305550#952770
Nazmun Nahar Dipty
"fatima alasfoor" wrote in message <oadqqf$kq5$1@newscl01ah.mathworks.com>...<br>
> "vignesh venkataraman" wrote in message <jf63ob$3jn$1@newscl01ah.mathworks.com>...<br>
> > fatima alasfoor i'm also working on same topic , can you give me a copy of your matlab code please..

Wed, 29 Mar 2017 22:28:03 +0000
Re: start executing external program from simulink
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/148023#952769
vcmorini
Hi,<br>
<br>
I have the same doubt!

Wed, 29 Mar 2017 22:20:03 +0000
Re: Plotting 3D functions with a constraints
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/344548#952768
MICHELLE AMARAL
Is it possible to graph the original 3D function and the constraint? It isn't always the case that the constraint is as simple as this example. Even if it is simple it would be nice to have the line slicing through the 3D function.<br>
<br>
For example, if the original function is F(x,y)=x*y and it is subject to the constraint 4x+2y=60<br>
<br>
Thanks for the help<br>
<br>
"Steven Lord" <Steven_Lord@mathworks.com> wrote in message <naf76p$ed2$1@newscl01ah.mathworks.com>...<br>
> <br>
> <br>
> "Sandro Al Jalkh" <sandro.aljalkh@mail.mcgill.ca> wrote in message <br>
> news:naaqgv$ds5$1@newscl01ah.mathworks.com...<br>
> > Hey I was wondering if it possible to plot a 3D function subjected to <br>
> > constraints:<br>
> > For example: I want to plot: f(x,y)=330x  64y subject to x+y <=10<br>
> <br>
> % Generate a grid of XY coordinates<br>
> [x, y] = meshgrid(0:0.125:10);<br>
> <br>
> % Evaluate the function on the grid<br>
> z = 330*x64*y;<br>
> <br>
> % Set those function values whose coordinates do not satisfy the constraint <br>
> to NaN<br>
> z(~(x+y<=10)) = NaN;<br>
> <br>
> % Create a surface plot<br>
> surf(x, y, z)<br>
> <br>
>  <br>
> Steve Lord<br>
> slord@mathworks.com<br>
> To contact Technical Support use the Contact Us link on <br>
> <a href="http://www.mathworks.com">http://www.mathworks.com</a>

Wed, 29 Mar 2017 19:45:03 +0000
Import all columns of a fixedwidth text file in workspace
https://uk.mathworks.com/matlabcentral/newsreader/view_thread/348013#952766
Neirda
Hi,<br>
I need to import all variables from a fixed width file as vectors in the Workspace. The files have the following characteristics<br>
 Time series, text file,<br>
 two first raws are a useless header<br>
 third line lists all variable names ; TIME on first column, then recorded variables<br>
 4+ lines are data<br>
 the number of variables (i.e. columns) vary from one file to another<br>
 the number of lines vary from one file to another (hopefully not a constraint here)<br>
 all columns (including TIME), have the same width (fixed"constant"width file!)<br>
<br>
I can use uiimport as a script, but I need to set it again each time the number of recorded variables changes. I couldn't find a way to cope with the unknown number of column.<br>
<br>
One (dirty?) way to address the issue could be to measure the length of a (e.g. third) line, divide by the constant width, but I couldn't find a way to get length(third_line).<br>
<br>
Thanks for your help