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

Sat, 29 Apr 2017 09:25:03 +0000
PARPOOL GIVING ERROR MESSAG WHEN I AM GIVING NUMBER OF WORKERS GREATER THAN 12
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348361#953568
Dhiman Bhowmick
I am using MATLAB R2014b. I want know the numbers of greater than 12 , but I am getting error message doing so. Is it limitation of the matlab version I am using or it is limitation of my hardware configuration??

Sat, 29 Apr 2017 05:59:03 +0000
Re: Converting Matrix to Vector
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348357#953567
Bruno Luong
A=[ 1 6 11;<br>
2 7 12;<br>
3 8 13;<br>
4 9 14;<br>
5 10 15 ]<br>
<br>
i=ones(size(A));<br>
i(1,2:end)=0;<br>
accumarray(cumsum(i(:)),A(:),[],@mean)<br>
<br>
ans =<br>
<br>
1.0000<br>
2.0000<br>
3.0000<br>
4.0000<br>
5.5000<br>
7.0000<br>
8.0000<br>
9.0000<br>
10.5000<br>
12.0000<br>
13.0000<br>
14.0000<br>
15.0000<br>
<br>
>>

Sat, 29 Apr 2017 04:34:03 +0000
Re: jpeg image to movie
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/33586#953565
Kevin Bartlett
You might want to try my jsanim.m function in the Mathworks file exchange (https://www.mathworks.com/matlabcentral/fileexchange/36052webbrowserviewableguianimationsofpngsgifsetc).<br>
<br>
The jsanim.m function is built on the same code used at www.vidmyfigs.com. You can bypass jsanim.m entirely by going to vidmyfigs.com and using the GUI there to add your image files. The "movie" plays back in your Web browser. <br>
<br>
Kumar <rai@purdue.edu> wrote in message <eeac2f1.1@WebX.raydaftYaTP>...<br>
> Hi,<br>
> <br>
> <br>
> I am trying to make a MATLAB movie using the jpeg image frames. I am <br>
> reading jpeg images from files. I execute the following commands<br>
> <br>
> <br>
> A = imread('figA', 'jpg');<br>
> B = imread('figB', 'jpg');<br>
> <br>
> <br>
> F(1) = im2frame(A);<br>
> F(2) = im2frame(B);<br>
> <br>
> <br>
> movie(F)<br>
> <br>
> <br>
> MATLAB executes all the commands successfully and it opends a window <br>
> for movie but doesn't show anything in that window.<br>
> <br>
> <br>
> What I might be doing wrong?<br>
> <br>
> <br>
> Thanks

Fri, 28 Apr 2017 23:02:56 +0000
Re: MATLAB SOURCE CODE FOR JPEG2000
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/75283#953564
omnia.71.10@gmail.com
On Tuesday, 7 September 2004 19:33:41 UTC+3, radhakrishnan wrote:<br>
> On 14 May 04 22:58:41 0400 (EDT), <br>
> i want ur source code <br>
> plz send it to me.

Fri, 28 Apr 2017 22:59:54 +0000
Re: Converting Matrix to Vector
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348357#953563
dpb
On 04/28/2017 1:05 PM, T.Cowan wrote:<br>
> How do I create a vector from a matrix in which the last element in a<br>
> column is averaged with the first element in the next column?<br>
><br>
> Example:<br>
><br>
> Matrix:<br>
> [ 1 6 11;<br>
> 2 7 12;<br>
> 3 8 13;<br>
> 4 9 14;<br>
> 5 10 15 ]<br>
> Desired Vector:<br>
> [1, 2, 3, 4, (5+6)/2, 7, 8, 9, (10+11)/2, 12, 13, 14, 15]<br>
><br>
> I keep getting tripped up because the number of elements in the vector<br>
> will be less than the elements in the matrix due to the averaging of<br>
> some of the matrix terms.<br>
<br>
Don't worry about that 'til the end...a straightahead solution, the <br>
"trick" didn't pop out at me as yet...<br>
<br>
>> N=M(:);<br>
>> r=size(M,1);<br>
>> for i=r:r:numel(M)r % each column last element less last column<br>
N(i)=mean(M(i:i+1)); % average it and next, put in 1st location<br>
N(i+1)=nan; % mark second location for deletion later<br>
end<br>
>> N=N(isfinite(N)) % and keep those elements we want<br>
N =<br>
1.0000<br>
2.0000<br>
3.0000<br>
4.0000<br>
5.5000<br>
7.0000<br>
8.0000<br>
9.0000<br>
10.5000<br>
12.0000<br>
13.0000<br>
14.0000<br>
15.0000<br>
>><br>
<br>
Can do in place if wanted.<br>
<br>
Could undoubtedly build the indexing expression for accumarray() or the <br>
like, but this should be pretty quick since uses allocated array to <br>
build and then just selects the final subset in one operation.<br>
<br>


Fri, 28 Apr 2017 22:04:03 +0000
Re: unable to delete a file
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/170147#953560
Joe
> Me as well, Matlab R2016b. But the file was created with diary() function, not fopen().<br>
> I'm still unable to produce a stable reproduction recipe to report to Mathworks. But it would be nice if anyone would find it. I suspect, that this might be associated with parallel processing toolbox, and/or with opening multiple Matlab instances.<br>
<br>
Me too! I am using the parallel tool box to open multiple files. I've got multiple " fclose('all');" statements riddled throughout the code, but after the parfor loop ends, I cannot delete the files. Any updates anyone?

Fri, 28 Apr 2017 21:59:03 +0000
Re: dispersion curve for lambs equation, complex, real, and imaginary numbers
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/254705#953559
cagatay yilmaz
Hi I am also trying to solve Lamb wave dispersion curves in Matlab. Did you able to find a solution. I am using fzero command to solve equations but it creates complex numbers.<br>
"jimmy mac" wrote in message <h21h6d$rjg$1@fred.mathworks.com>...<br>
> Im having trouble solving a set of equations which are supposed to be fairly simple. The series of equations is for Lamb waves am getting curves indicating different modes, but they are very off from where they should be. For example, the symmetric a0 and a1 curves connect at a frequency*diameter of 1000 but it should be well towards 3000mhtz mm . I must be making some type of simple programming mistake but have been stuck on this for a few week but for practical purposes, months.<br>
> .<br>
> <br>
> For lambs equation, you solve for the zero crossings in order to find propagation speeds of the wave in material. The equation for lamb is very simple but it gets tricky as it can have comlex parts. <br>
> .<br>
> When the equation is written in the form indicated in JL roses book on ultrasonic waves, page 110111, these complex numbers should not be a problem. This can be referenced at no change from google books<br>
> <a href="http://books.google.com/books?id=DEtHDJJRS4C&pg=PA110&dq">http://books.google.com/books?id=DEtHDJJRS4C&pg=PA110&dq</a><br>
> <br>
> Altough there are a few dispersion curve files people have uploaded, none is releavant for this application.,<br>
> <br>
> Here is my code so far.<br>
> The p and q are complex which makes lamb equations complex<br>
> <br>
> clear<br>
> <br>
> warning off %shut off warning on divide by zero<br>
> <br>
> d = 0.0005; % 1.7mm<br>
> %f = 1000000; %1mhtz<br>
> %since the roots occur at very small decimal vales, you need to decimate cp<br>
> %by about 0.01. Otherwise it will miss roots and then, the data values will<br>
> %shift.<br>
> cp = 1:1:10000; %range of possible cp values<br>
> cl = 4000; %cl of aluminum<br>
> ct = 1800; %ct of aluminum<br>
> start_point = .1 % (f*d); this is because .1 on dispersion curve is where it starts to get interesting<br>
> end_point = 4000000<br>
> skip = 10000<br>
> start_frequency = start_point/d ; %holding diamester constant find frequncy to start<br>
> % change_sign_occured2 = zeros(5000:200);<br>
> <br>
> matt_index = 1<br>
> <br>
> for f = start_frequency:skip :end_point<br>
> w = 2*pi*f; %angular frequency<br>
> matt_index = matt_index + 1;<br>
> <br>
> <br>
> %% Solve Lamb's equation numerically<br>
> %equations are from J.Roses book, formatted to remove complex numbers<br>
> %Book is in library and shiva has a zeroxed copy.<br>
> h = d/2 ; %h term from Rose<br>
> k2 = (w./cp).^2 ; %<br>
> p2 = ((w/cl)^2)  (k2); %P squared term from Rose book<br>
> p = (((w/cl)^2)  (k2)).^.5; <br>
> q2 = ((w/ct)^2)  (k2); %q squared term from rose<br>
> q = (((w/ct)^2)  (k2)).^.5;<br>
> lamb = real((tan(q.*h)./q) + 4.*k2.*p.*tan(p.*h) ./((q2  k2).^2));<br>
> lamb2 = real((q.*tan(q.*h))+ ((q2  k2).^2).*tan(p.*h)./(4.*k2.*p));<br>
> %plot(cp,lamb)<br>
> <br>
> %% Find zero crossings<br>
> %Part 1<br>
> %Check if the absolute value is the same as numerical value<br>
> %Hold negative numbers with index 1 and +1 for postive in an array of same<br>
> %index. There are also NaN, i dont know how they got in, but we need to<br>
> %find them with the isnan function and then assign them the old value.<br>
> %There are two parts, part one finds symmetric roots, part two antisymmetric<br>
> %Symmetric Roots<br>
> change_sign_occured = [];<br>
> numbersign = zeros(1,length(lamb));<br>
> findNaN = isnan(lamb);<br>
> for n = 1:length(lamb)<br>
> if n > 1 %dont run the first loop due to n1 term giving error<br>
> if abs(lamb(n))> lamb(n)<br>
> numbersign(n) = 1 ; %flag for negative number<br>
> end <br>
> if abs(lamb(n))== lamb(n)<br>
> numbersign(n) = 1 ; %postive number<br>
> end<br>
> if findNaN(n) == 1 %correspond array of numbers indicating Nan<br>
> numbersign(n) = numbersign(n1); %assign old number<br>
> <br>
> end<br>
> if numbersign(n) ~= numbersign(n1) %check the last to see if equal<br>
> change_sign_occured = [change_sign_occured, n];<br>
> end <br>
> end<br>
> end<br>
> %display(['symmetric ', num2str(f)])<br>
> change_sign_occured2a(matt_index ,1:size((change_sign_occured),2)) = change_sign_occured ;<br>
> fd(matt_index) = f*d;<br>
> <br>
> %Part 2  Antisymmetric Roots<br>
> %i had to assign an initial chnagesign that was not + or  which<br>
> %automatically flips<br>
> change_sign_occured2 = [];<br>
> numbersign2 = zeros(1,length(lamb2));<br>
> findNaN2 = isnan(lamb2);<br>
> for n = 1:length(lamb2)<br>
> if n > 1 %dont run the first loop due to n1 term giving error<br>
> if abs(lamb2(n))> lamb2(n)<br>
> numbersign2(n) = 1 ; %flag for negative number<br>
> end <br>
> if abs(lamb2(n))== lamb2(n)<br>
> numbersign2(n) = 1 ; %postive number<br>
> end<br>
> if findNaN2(n) == 1 %correspond array of numbers indicating Nan<br>
> numbersign2(n) = numbersign2(n1); %assign old number <br>
> end<br>
> if numbersign2(n) ~= numbersign2(n1) %check the last to see if equal<br>
> change_sign_occured2 = [change_sign_occured2, n];<br>
> end <br>
> end<br>
> end<br>
> %display(['antisymmetric ', num2str(f)])<br>
> change_sign_occured2b(matt_index ,1:size((change_sign_occured2),2)) = change_sign_occured2 ;<br>
> <br>
> end<br>
> <br>
> %% Paste Arrays together and put into Excel<br>
> %in excel, remove 0s if need be.<br>
> change_sign_occured2a(:,1)=transpose(fd);%replace bogus values in first column with f*d data<br>
> change_sign_occured3 = zeros(size(change_sign_occured2a,1),size(change_sign_occured2b,2)+size(change_sign_occured2a,2));<br>
> change_sign_occured3(1:size(change_sign_occured3,1),1:size(change_sign_occured2a,2)) = change_sign_occured2a<br>
> change_sign_occured3(1:size(change_sign_occured3,1),size(change_sign_occured2a,2)+1:size(change_sign_occured3,2)) = change_sign_occured2b<br>
> dlmwrite('matt.csv', change_sign_occured3, ',');

Fri, 28 Apr 2017 20:41:49 +0000
Re: how to enter rahnged functions?
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348354#953558
dpb
On 04/28/2017 1:20 PM, dpb wrote:<br>
> On 04/28/2017 9:21 AM, ismail PAINTER wrote:<br>
>> So I want to enter this function in MATLAB script file.<br>
>><br>
>> (a) f( net ) = 1 if net > 0 , f( net ) = 1 if net <= 0<br>
...<br>
<br>
><br>
> There's already a function for the first, it's signum function,<br>
><br>
> doc sign % for details<br>
<br>
Actually, it isn't precisely your definition; I didn't notice the <= on <br>
zero. SIGN() returns 0 at origin; if that's not desired then wrap in a <br>
new function and fixup the origin.<br>
<br>


Fri, 28 Apr 2017 20:27:07 +0000
Error Initialisation
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348358#953557
Sara Muhtar
Hi<br>
<br>
i have this problem, I keep getting this exception when the program is trying to pass the information written from the C# interface into MATLAB<br>
<br>
"System.MissingFieldException: Field not found<br>
MathWorks.MATLAB.NET.Arrays.MWArray.MCRAppInitialized"<br>
<br>
Does anyone have a solution?

Fri, 28 Apr 2017 20:05:03 +0000
Re: need help
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348356#953556
someone
"joseph richa" wrote in message <oe004u$j8$1@newscl01ah.mathworks.com>...<br>
> Write a Matlab function Romberg.m allowing to calculate the integral ? f(x) dx from a to b using the method of Romberg. We want to use the Matlab function “inline(‘f’)” in order to read the function to be integrated in its analytical form, expl: f = inline (‘sin(x)^2’) if f(x) = sin2(x). The input of the function: the expression to be intergrated, the a and b values and the maximum number of intervals n. The output of the function: the integral value.<br>
<br>
We are happy to help. What have you tried so far?

Fri, 28 Apr 2017 18:39:03 +0000
Re: DVR DSTATCOM Simulation problem
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348178#953555
Samir Abood
"pravinsinh parnar" wrote in message <ockcpf$s0j$1@newscl01ah.mathworks.com>...<br>
> I am working on MATLAB simulation of DVR AND DSTATCOM for voltage sag and swell mitigation. when i created sag and swell by using Programmable Voltage Source( by changing Amplitude of voltage for specific time duration), my DVR and DSTATCOM mitigate sag and sell successfully but when i created sag and swell by changing(switching highly inductive or Capacitive Load) at that time my DVR and DSTATCOM can not mitigate sag and sell........so i just want to know whats the problem behind this for not providing mitigation by DVR & DSTATCOM? i have used SRF theory and SVPWM pulse generation technique and using linear load at 415 volts supply system(single feeder)......i will be very thankful if someone give me solution as soon as possible. my email id is : pravinsinhparmar7@gmail.com

Fri, 28 Apr 2017 18:20:48 +0000
Re: how to enter rahnged functions?
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348354#953554
dpb
On 04/28/2017 9:21 AM, ismail PAINTER wrote:<br>
> So I want to enter this function in MATLAB script file.<br>
><br>
> (a) f( net ) = 1 if net > 0 , f( net ) = 1 if net <= 0<br>
> (b) f( net ) = 1 if net > 0 , f( net ) = 0 if net <= 0 – Heavy side<br>
> function.<br>
><br>
> Any ideas?<br>
<br>
<br>
<<a href="http://www.mathworks.com/help/matlab/matlab_prog/localfunctionsinscripts.html">http://www.mathworks.com/help/matlab/matlab_prog/localfunctionsinscripts.html</a>><br>
<br>
There's already a function for the first, it's signum function,<br>
<br>
doc sign % for details<br>
<br>
If have Symbolic Toolbox, there's a Heaviside function in it. Otherwise <br>
it's just<br>
<br>
y=double(net>0); % cast logical to default double<br>
<br>
<br>


Fri, 28 Apr 2017 18:06:28 +0000
Re: While loop help, fundamentals
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348355#953553
dpb
On 04/28/2017 12:44 PM, Jim Tom wrote:<br>
> I know this is a vague question but can someone help me with<br>
> understanding the differences in while loops and for loops. And explain<br>
> its uses along with maybe an example of a while loop? Thanks.<br>
<br>
FOR loops are counted; WHILE loops are conditional.<br>
<br>
What's wrong with the Examples at<br>
<br>
doc while % ?<br>
<br>
If those don't clarify your understanding, ask a _specific_ question <br>
regarding what you're trying to do.<br>
<br>


Fri, 28 Apr 2017 18:05:13 +0000
Converting Matrix to Vector
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348357#953552
T.Cowan
How do I create a vector from a matrix in which the last element in a column is averaged with the first element in the next column?<br>
<br>
Example:<br>
<br>
Matrix:<br>
[ 1 6 11;<br>
2 7 12;<br>
3 8 13;<br>
4 9 14;<br>
5 10 15 ] <br>
<br>
Desired Vector:<br>
[1, 2, 3, 4, (5+6)/2, 7, 8, 9, (10+11)/2, 12, 13, 14, 15]<br>
<br>
I keep getting tripped up because the number of elements in the vector will be less than the elements in the matrix due to the averaging of some of the matrix terms.

Fri, 28 Apr 2017 18:03:10 +0000
need help
https://nl.mathworks.com/matlabcentral/newsreader/view_thread/348356#953551
joseph richa
Write a Matlab function Romberg.m allowing to calculate the integral ? f(x) dx from a to b using the method of Romberg. We want to use the Matlab function “inline(‘f’)” in order to read the function to be integrated in its analytical form, expl: f = inline (‘sin(x)^2’) if f(x) = sin2(x). The input of the function: the expression to be intergrated, the a and b values and the maximum number of intervals n. The output of the function: the integral value.