f



MATLAB-help!!!

I am trying to write code to iterate a function 50 times, however,
every time i write it without help i get ()-indexing must appear last
in an index expression.

I'm not sure what this means or how to fix it, can someone please
explain.

Also, my input is this:

x(i)=a*x(i-1)(1-x(i-1)+h*x(i-1)^2/2)
0
1/23/2012 11:45:31 PM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
844 Views

Similar Articles

[PageSpeed] 42

On Jan 24, 12:45=A0pm, michelle taylor <miss.smileyf...@gmail.com>
wrote:
> I am trying to write code to iterate a function 50 times, however,
> every time i write it without help i get ()-indexing must appear last
> in an index expression.
>
> I'm not sure what this means or how to fix it, can someone please
> explain.
>
> Also, my input is this:
>
> x(i)=3Da*x(i-1)(1-x(i-1)+h*x(i-1)^2/2)

Aren't you missing an operator?
x(i)=3Da*x(i-1) here (1-x(i-1)+h*x(i-1)^2/2)

x(i)=3Da*x(i-1)*(1-x(i-1)+h*x(i-1)^2/2)
or
x(i)=3Da*x(i-1)/(1-x(i-1)+h*x(i-1)^2/2)
or
x(i)=3Da*x(i-1)^(1-x(i-1)+h*x(i-1)^2/2)
0
mulgor (3008)
1/23/2012 11:58:49 PM
On Jan 23, 3:58=A0pm, TideMan <mul...@gmail.com> wrote:
> On Jan 24, 12:45=A0pm, michelle taylor <miss.smileyf...@gmail.com>
> wrote:
>
> > I am trying to write code to iterate a function 50 times, however,
> > every time i write it without help i get ()-indexing must appear last
> > in an index expression.
>
> > I'm not sure what this means or how to fix it, can someone please
> > explain.
>
> > Also, my input is this:
>
> > x(i)=3Da*x(i-1)(1-x(i-1)+h*x(i-1)^2/2)
>
> Aren't you missing an operator?
> x(i)=3Da*x(i-1) here (1-x(i-1)+h*x(i-1)^2/2)
>
> x(i)=3Da*x(i-1)*(1-x(i-1)+h*x(i-1)^2/2)
> or
> x(i)=3Da*x(i-1)/(1-x(i-1)+h*x(i-1)^2/2)
> or
> x(i)=3Da*x(i-1)^(1-x(i-1)+h*x(i-1)^2/2)

Thank you
0
1/24/2012 12:05:08 AM
Reply:

Similar Artilces:

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

Matlab engine with matlab R2010b
Hello All, I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡ ...

Matlab help
This is a small part of my whole project (Speech/Music Discrimination). I can wavread all the wave files when the code is in the current directory. Using this file=dir('*.wav'); for i=1:length(file); [s, fs]=wavread(file(i).name); commands statements etc, in here... end The problem is i want to used this code to other folders without moving it in that directory. For example there are wave files in the Musicvoice folder I edited the code to something like this to access the wave files in the Musicvoice. file=dir('Musicvoice\*.wav'); for i=1:length(file); [s, fs]=wavread(file(i).name); commands statements etc, in here... end It gave me the error below. Please help. ??? Error using ==> wavread Cannot open file. Error in ==> extractFeature at 16 [s, fs]=wavread(file(i).name); %wavread function returns s and the sampling frequency kingdavid3 wrote: > This is a small part of my whole project (Speech/Music > Discrimination). I can wavread all the wave files when the code is in > the current directory. > > Using this > > file=dir('*.wav'); > > for i=1:length(file); > > [s, fs]=wavread(file(i).name); > > commands statements etc, in here... > > end > > The problem is i want to used this code to other folders without > moving it in that directory. For example there are wave files in the > Musicvoice folder I edited the code t...

[JOB] Help
Hi all Sorry to advertise within the user group but I really need some help! I was hoping that people in this usergroup could help other fellow Matlab developers who may be looking for a new role, or might be interested in what I have on offer. I need to find a Application engineer who is a confident developer with Matlab and its toolboxes. Competent at explaining to people how and why they are doing things with the technology, able to solve complex problems with simple solutions. Plus, have have a burning desire for technology. Personally, I have been looking for this type of person for almost 4 months and I am almost ready to give in, but I wont be beaten! If anyone is a experienced within C++ / C or Java, and have a lot of experience with using Matlab, then please get in touch with me. My contact details are danielsheppard1983@gmail.com or call me on 0282523120 thanks for letting me post this, I just really needed the help Thanks Dan "Dan Sheppard" <danielsheppard1983@gmail.com> wrote in message news:bd137cfa-cbbb-4069-8d6b-3721cba3b17b@t8g2000pbe.googlegroups.com... > Hi all > > Sorry to advertise within the user group but I really need some help! > I was hoping that people in this usergroup could help other fellow > Matlab developers who may be looking for a new role, or might be > interested in what I have on offer. > > I need to find a Application engineer who is a confident developer >...

Matlab Code and help
Hi I need help on below...pls can some one give me the code I need to carry out these steps in Matlab.. Take an image in Raw in TIFF file...and then perform a) JPEG @ quality 100, 80, 60, 40, 20 and 0 b) SPIHT @ quality 100, 80, 60, 40, 20 and 0 c) EZW @ quality 100, 80, 60, 40, 20 and 0 Next step - Get MSE for all the above need to plot the graph.. Many Thanks "Indrasena " <mail2svijay@yahoo.com> wrote in message hello, may i know were you able to do this, becasue took me a while to do this code, need some clarificatiosn if you are done because i am done with SPIHT and EZW is left? what r u using the built in codes or the the matlab toolbox?? contact me at makeyourassignment@yahoo.com ...

Help with Parallel Matlab
Long story short, here is the criteria I need. 1) I need two modules running in parallel. One function must activate these two They don't need to START at the same time but both neither return info nor end. They run pretty much infinitely 1.1) I would prefer if the One function also ran separate from the above two in it's own loop but i can deal with a 3'rd function also not ending. 2) I need a shared variable between two of the modules. 1 Module will place information there while the other just reads it, but as they are running parallel. That's it. I can do this in pretty much any other language but matlab I've been having issues with. Problem is I absolutely need to use matlab for one module. If this is impossible to accomplish all in matlab then can i instead run this in C and call one matlab module with separate thread? Sample code below. function mainParallelTest() persistent counter; counter = 0; parfor i=0:2 if (i == 0) ImageProccessorParallelTest(); elseif(i == 1) EventProcessorParallelTest(); elseif(i == 2) prevCounter = 0; tempCounter = 1; while(true) tempCounter = counter; if (tempCounter == prevCounter) %disp('hi') end prevCounter = tempCounter; end end end "Alex Cruikshank" <cruiksam@gmail.com> writes: > Long story short, here is the criteria I need. >...

Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow: result=zeros(25,16000); for i = 1:length(vector1) % length is 25 for j = 1:length(vector2) % length is 16000 temp1 = vector1(i); temp2 = vector2(j); t1 = load(matfiles1(temp1).name) %load image1 from matfile1 t2 = load(matfiles2(temp2).name) % load image2 from matfile2 result(i,j)=t1.*t2 end end It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance! ...

Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors to the MATLAB Central File Exchange. Look for your favorite contributors on our File Exchange Author Profile page. You can read their profiles and see pictures: <http://www.mathworks.com/matlabcentral/reports/fileexchange/allProfiles/> In a random drawing, we recently awarded MATLAB jackets to three File Exchange authors with profile pages: Michele Giugliano, Andrey Egin, and Denis Gilbert. You can win a jacket, too. Just submit a new file to the File Exchange or update your author profile by December 2003 for a chance to win one of four MATLAB jackets. See the jacket below: <http://www.mathworks.com/matlabcentral/images/jeff3.jpg> Here are some interesting File Exchange facts: - Since its inception in 2001, visitors have downloaded more than 1.25 million submissions from the File Exchange. - In September 2003 alone, visitors downloaded 80,085 files, an average of 2670 a day! .... what if the prize was a free copy of the next version of Matlab :-) majb Min Poh wrote: ....or an offer for employment... aj "bourassa" <bourassa-m@rmc.ca> wrote in message news:3f9d507d$1@rmcnt03a.rmc.ca... > ... what if the prize was a free copy of the next version of Matlab :-) > > majb > > Min Poh wrote: > ...

Matlab LVQ Help
Hi, I am new on neural network toolbox. I am trying to use LVQ algorithm,but it is not working at all. Right now I am trying to train the network for a simple sine curve, but it is not trained according to the target. Can you help me with your suggestion, my function is y=sin(x); x is my input and y is my target output. I classified target results in four different classes. 0.5<=value<=1.0; class 1 0.0<=value<0.5; class 2 -0.5<=value<0.0; class 3 -1<=value<-0.5; class 4 I would highly appriciate if you help me with some idea, i am stucked here for a long time. Here is the code I am using, --------------------------------------------------- t=-5:.1:5; x=t; for i=1:length(x) y(i)=sin(x(i)); end for i=1:1:length(y) if(0.5<(y(1,i)) && (y(1,i))<=1) tc1(1,i)=1; end end for i=1:1:length(y) if(0<=(y(1,i)) && (y(1,i))<0.5) tc1(1,i)=2; end end for i=1:1:length(y) if(-0.5<=(y(1,i)) && (y(1,i))<0) tc1(1,i)=3; end end for i=1:1:length(y) if(-1.0<=(y(1,i)) && (y(1,i))<-0.5) tc1(1,i)=4; end end p1=x; check(1,:)=p1; check(2,:)=tc1; checkall=sortrows(check,2); p=checkall(1,:); tc=checkall(2,:); t=ind2vec(tc); targets=full(t); sc=16; calu(1,1)=sum(targets(1,:)); calu(2,1)=sum(targets(2,:)); calu(3,1)=sum(targets(3,:)); calu(4,1)=sum(targets(4,:)); c1=calu(1,1)/(sum(calu(1,1)+calu(2,1)+calu(3,1)+calu(4,1))); c2=calu(2,1)/(sum(calu(1,1)+calu(2,1)+calu(3,1)+calu(4,1))); c3=calu...

help new in MATLAB
Hi Maybe a too easy problem for you but maybe you help me to solve this in MATLAB I have a vector of point let say for example sin(x) from -PI to PI and I would like to plot the -- vector -- derivative of the vector -- integral of the vector any idea how do do this in MATLAB Thks On 8/5/2012 1:15 PM, mourad wrote: > Hi > Maybe a too easy problem for you but maybe you help me to solve this in > MATLAB > I have a vector of point let say for example sin(x) from -PI to PI > and I would like to plot the > -- vector > -- derivative of the vector > -- integral of the vector > doc plot doc diff doc trapz -- ...

Need Help With Matlab
Hi I am trying to simulate the low pass filtered output of a square wav (pulse train) using Matlab. The pulse varies between 0 and 1. So th filtered output looks somewhat like a sinewave. The filter is a low pas filter (FIR/raised cosine filter). Essentially what I need is to be abl to generate a look up table that will store the output waveform rise fall transition (from 0-1 and 1-0). So what i want essentially is to b able to generate a look up table of different lengths (like 100,50 etc) t store these transitions. I tried using Simulink for this, but havent bee successful so far. So my table will look something like 1 0.995 0.923 0.91 0.85 ..... to 0 Any help is highly appreciated. Thanks. Best regards Vikram ...

MatLab help #27
Hi, I have a copy of a program that reads two small pngs and sends them out over two serial ports. It's old and its evidently a bad edit, so could someone please tell me what's the matter with this crazy thing?! It seems to be in the variables and then it blows its cool in the reshape command. I have not programmed anything in MatLab since forever, but i need this to work for a project I am doing. Best copy I have, evidently I deleted the working copy and for the life of me, I can't fix it. Any good people out there that can help edit this crazy thing back to health? See code below, relatively straightforward, but its not compiling...I dunno. My feeble attempts to fix it after all these years is...um... feeble... ;-) I barely remember how to load up a script, much less. BUT I gotta have it, any takers? Best Regards, Jeff ------------------------------------------------------------- %Read two image files A=imread('Bright1.png','png'); B=imread('Bright2.png','png'); A=rgb2gray(A); B=rgb2gray(B); [a1 b1]=size(A); [a2 b2]=size(B); count1=a1*b1; count2=a2*b2; count=min(count1,count2); C1=reshape(A1,1,count1); C2=reshape(A2,1,count2); %Create serial port objects to open the serial ports s1=serial('com6','baudrate',230400,'outputbuffersize',2*count); fopen(s1); s2=serial('com5','baudrate',230400,'inputbuffersize',2*count); fopen(s2); %Seri...

Call Matlab m-file from Matlab Scrip Node
My problem with matlab script node is related to calling function in matlab.&nbsp; I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.&nbsp; My matlab script node doesn't seem to recognize my function.&nbsp; I have placed the function in the folder the vi is currently located, but it doesn't read it.&nbsp; How do I get matlab script node to read the functions I create in matlab? Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m) Let me clarify, &nbsp; I have pasted my matlab code into the matlab scrip node. &nbsp; In this code, I have called a subfunction that I have created. &nbsp; Example k(n)=k_c(T(n)) where k_c is a subfunction I have created. &nbsp; How do I get my code in the node&nbsp;to sucessfully read the subfunction k_c? &nbsp; &nbsp; &nbsp; As indicated, you need to add the directory where the .m file containing the function resides to the list of paths that are read in. This is your startup.m file. The other option is to do a "cd" command prior to calling your function to change to the directory where the .m file containing the function resides. Thanks for reiterating the information.&nbsp; My matlab script node is working properly.&nbsp; I had never used the "cd" command in matlab.&nbsp; I always set the working directory when I open the program, and put all the m files into t...

Matlab code help #3
Please, can anyone here help me to create code to generate new random numbers of initial conditions at each time step of a simulation? On Thursday, April 19, 2012 12:32:26 PM UTC+12, pat boatemaa wrote: > Please, can anyone here help me to create code to generate new random numbers of initial conditions at each time step of a simulation? help rand help randn On Apr 18, 8:32=A0pm, "pat boatemaa" <patboate...@yahoo.com> wrote: > Please, can anyone here help =A0me to create code to generate new random = numbers of initial conditions at each time step of a simulation? -------------------------------- Here's an example of a Monte Carlo simulation (basically what you're doing). http://groups.google.com/group/comp.soft-sys.matlab/browse_frm/thread/80834= b3a20d72932/b6011100832e8092?hl=3Den&lnk=3Dgst&q=3Dmonte+carlo#b6011100832e= 8092 I'm sure you can find several others. ...

Help with Matlab
function X = quiz(a) a = [0.001:1e-6:0.05]; b = .100; A = pi.*a./(2.*b); P = sqrt(tan(A)./A); Q = 0.752 + 2.02.*a./b + 0.37.*(1 - sin(A)).^3; R = cos(A); Y = P.*Q./R; C = 8.20*10^-13; m = 3.5; S = 500; X = 1./(C.*(S.*Y).^m); trapz(a,X); end I keep getting an output that is not a single number but an array. I don't know how to evaluate this integral using the trapz function and I can't find any more help... Thanks for all the help!! Niket, You are getting X as the output, this is why. You should instead get the result of trapz as follows: function I = quiz() ..... ..... I = trapz(a,X); ...

Help with this matlab for loop code
Hello all, I have this matlab code which has this for loop construct for l= 1:1:orders_l Here orders_l takes on integer values. Is this not the same as saying: for l= 1:orders_l If not, what would be the usual C++/JAVA equivalant? Many thanks for any help you can give me, Luca "Luca" <luca.pamparana@gmail.com> wrote in message news:a95e73ac-1f3d-4296-955a-4c514c1890a9@f27g2000yqc.googlegroups.com... > Hello all, > > I have this matlab code which has this for loop construct > > for l= 1:1:orders_l > > Here orders_l takes on integer values. Is this not the same as saying: > > for l= 1:orders_l Yes, "a:1:b" is the same as "a:b" [assuming neither a nor b are objects with an overloaded COLON method, in which case it depends on the implementation of the overload.] http://www.mathworks.com/help/techdoc/ref/colon.html BTW, please yell at the person who wrote that code about their choice of loop variable name. [Please don't mix lower-case L's, upper-case i's, and number 1's in the same line of code -- and ideally don't mix them in the same program. In many fonts, it's too easy to mistake one for another and locating/realizing the mistake during a debugging session could be time consuming.] -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

bar
In MatLab 6.5, the routine above works normal: figure; sem=Average(:,2)./sqrt(Average(:,3)); bar([1:1:7],Average(:,1),sem); ylabel('% of epochs analyzed') xlabel('Frequency Band') title ('Occurrence of Oscillatory Events - Ch X') %Where Average and sem are vectors; But, in MatLab 7.0, the same code cause the following error: ??? Error using ==> xychk Too many input arguments. Error in ==> bar at 53 [msg,x,y] = xychk(args{1:nargs},'plot'); Error in ==> cross_subj_analysis>ok_Callback at 327 bar([1:1:7],Average(:,1),sem); I'd like to know why this occour. Thanks Henrique In article <g7a1j6$l1$1@fred.mathworks.com>, Henrique Amaral <henriquetomaz@uol.com.br> wrote: >In MatLab 6.5, the routine above works normal: >figure; >sem=Average(:,2)./sqrt(Average(:,3)); >bar([1:1:7],Average(:,1),sem); >ylabel('% of epochs analyzed') >xlabel('Frequency Band') >title ('Occurrence of Oscillatory Events - Ch X') >%Where Average and sem are vectors; >But, in MatLab 7.0, the same code cause the following error: >??? Error using ==> xychk >Too many input arguments. >Error in ==> bar at 53 > [msg,x,y] = xychk(args{1:nargs},'plot'); >Error in ==> cross_subj_analysis>ok_Callback at 327 >bar([1:1:7],Average(:,1),sem); >I'd like to know why this occour. When the third argument is numeric, it must be the bar width. barwidth must b...

Matlab Audioplayer code help!
Hey, So im reworking a code. GUI with 3 buttons, all 3 button play songs when loaded from a file, So im using Audioplayer and its playing Button 1, but when i press button 2, Button 1 is still playing and button 2 also plays and so on with button 3... So my question is, what do I do so when Button 1 is playing and I press Button 2, Button 1 music is stopped and Button 2 music starts playing, same with Button 3. (I dont want to add any other buttons, I want it to stop automatically when I press other button and plays that song). function myplay(file) if isunix, %using system's play (from the sox package) on Unix (MATLAB's sound does not work) [s,w]=unix(['play ' file]); else, %using MATLAB's wavplay on Windows [y,fs]=wavread(file); player=audioplayer(y,fs); play(player); pause(max(size(y))/fs); end ...

Matlab builder JA: parse java string to matlab cell
Hi all, I'm building a java swing based GUI for my Matlab application. As such, user input is available as text strings, for example "{[0; 0], [3.5 0; 0 2]}" (mean vector and covariance matrix of a 2D Gaussian). The user input will be passed to the compiled matlab method as a MWCellArray. Problem is how do a convert (parse) the above string into a MWCellArray? From its javadoc http://www.mathworks.com/access/helpdesk/help/toolbox/javabuilder/MWArrayAPI/index.html the following method is available: java.lang.String toString() Returns a string representation of this array, but the reverse method is not. Evidently, parsing a string like the one above is a non trivial task and I'm loath to attempt writing one by myself. I would be very thankful if someone can point me to the required parser implementation. Matlab itself is carrying out this task all the time, perhaps it is possible to access Matlab's own parser. Help much appreciated, Ritesh ...

i need help in matlab coding
please any volunteer can give a code for the ieee paper Data Hiding in Motion Vectors of Compressed Video Based on Their Associated Prediction Error by Hussein A. Aly, Member, IEEE please i need it...so important...please if any one can do it please contact me:preetamreddy.pothala@gmail.com preetampothala@gmail.com thanks.... ...

matlab programming help #2
can anyone tell me whats wrong with this? =[ function[y]=horner_scheme (a,x) n = 1:n; b(n)=a(n); for i=n-1:-1:0 b(i)=((b(i+1))*x)+a(i); end y = b(0); im pretty sure all is right, except i keep getting the message 'the variable n can be used before it is defined' =S (line 2..) what does that mean? "matlabnoob noob" <counternoob@hotmail.co.uk> wrote in message news:gouo8d$rdl$1@fred.mathworks.com... > can anyone tell me whats wrong with this? =[ > > function[y]=horner_scheme (a,x) > n = 1:n; > b(n)=a(n); > for i=n-1:-1:0 > b(i)=((b(i+1))*x)+a(i); > end > y = b(0); > > > im pretty sure all is right, except i keep getting the message 'the > variable n can be used before it is defined' =S (line 2..) > > what does that mean? What do you think the value of n is? What are you trying to achieve with the line n=1:n; ? Arnaud "matlabnoob noob" <counternoob@hotmail.co.uk> wrote in message <gouo8d$rdl$1@fred.mathworks.com>... > can anyone tell me whats wrong with this? =[ > > function[y]=horner_scheme (a,x) > n = 1:n; > b(n)=a(n); > for i=n-1:-1:0 > b(i)=((b(i+1))*x)+a(i); > end > y = b(0); > > > im pretty sure all is right, except i keep getting the message 'the variable n can be used before it is defined' =S (line 2..) > > what does that mean? No, you are not getting it right. You were told in your...

need help in matlab implementation
Is their anybody help me in calculating the bit error rate of OFDM SIGNAL for BPSK, QPSK AND QAM SIGNAL in the papr reduction techniques like clipping and Selective level mapping, if anyone is having coding for the same please mail me on pmjadhav85@gmail.com. ...

Help: Optimization using Matlab
Hello all, I need to find the optimal value of x for the function (1- x^2/2R^2)^(1/x) in terms of R. Could someone please help, how I could do it in Matlab? Thanks a million, --Johnson fminsearch or fminbnd User10 wrote: > > > Hello all, > > I need to find the optimal value of x for the function (1- > x^2/2R^2)^(1/x) > in terms of R. > Could someone please help, how I could do it in Matlab? > > Thanks a million, > --Johnson > > > ...

Help needed with MATLAB GUI
Hi, I have a code for Doppler effect, can anyone give me a step-by-step guide to make it work in a GUI? (Pressing a button should execute this effect) In the code I have various parameters like path length, speeds, frequency, time, distances etc., how should I map them into the GUI's .m file? (Callbacks etc.) On 4/15/2012 8:21 AM, Rahul P wrote: > Hi, > > I have a code for Doppler effect, can anyone give me a >step-by-step guide to make it work in a GUI? (Pressing a button should execute this effect) > help guide --Nasser Try MAGIC: http://www.mathworks.com/matlabcentral/fileexchange/24224 Description This GUI will help the novice user get up to speed very quickly on using GUI-based applications. Everything is laid out in a very simple Step 1, Step 2, Step 3, etc. layout. It is a very good starting point for a typical image analysis application. This application uses GUIDE to do the user interface design, and has most of the basic controls such as buttons, listboxes, checkboxes, radio buttons, scrollbars, etc. It allows the user to ....................... ...

Web resources about - MATLAB-help!!! - comp.soft-sys.matlab

Resources last updated: 3/30/2016 2:43:27 PM