I have this function but when I called like [y z] = lab2_15192572_fun(-0.8) it gives me repeated answer and I am not sure whether it is the right answer or not. The answer is z = 1.6400 y = -0.3600 y = -0.3600 z = 1.6400 Is my function structure wrong? function [y,z] = lab2_15192572_fun(x) if abs(x) < 2 z = x^2 + 1 y = x^2 - 1 elseif 2< abs(x) <= 4 z = 1/(x^2 + 1) y = 1/(x^2 - 1) else z = cos(x) y = sin(x) end Mario Fatafehi wrote: elseif 2< abs(x) <= 4 2 < abs(x) will return either 0 (false) or 1 (true). You then check to see if that 0 or 1 is <= 4, which of course it is. If you want to check to see if a number is in a range, code both halves of the test, 2 < abs(x) && abs(x) <= 4 Walter Roberson <roberson@hushmail.com> wrote in message <hoeurm$nga$1@canopus.cc.umanitoba.ca>... > Mario Fatafehi wrote: > elseif 2< abs(x) <= 4 > > 2 < abs(x) will return either 0 (false) or 1 (true). You then check to > see if that 0 or 1 is <= 4, which of course it is. > > If you want to check to see if a number is in a range, code both halves > of the test, 2 < abs(x) && abs(x) <= 4 But why does it gives me repeated answer? "Mario Fatafehi" <coruba9@hotmail.com> wrote in message <hof3hk$pes$1@fred.mathworks.com>... > Walter Roberson <roberson@hushmail.com> wrote in message <hoeurm$nga$1...

Hi all, I am simulating a point robot in Simulink and simulating a LIDAR on the robot by drawing a fixed a number of fixed lines out of the robot as it moves to mimic the laser rays. One part of my code is to calculate the two set of points of the many part lines that I draw. Since to get the second set of co ordinates we have to deal with a quadratic equation then we usually get 2 sets of co ordinates and have to choose the right one. In order to choose the right set, I have implemented 4 IF statements to check in which quadrant the robot is facing (by seeing its angle with the axis). The correct IF statements are asserted when changing quadrant, however, the operation inside the IF statement is loosing its value. Here is my code if (pi/2 > (i-theta) && (i-theta) > 0) ytrue = max(y); xtrue = max(x); flag = 1; elseif (-pi > (i-theta) && (i-theta) > -3*pi/2 || pi > (i - theta) && (i - theta) > pi/2) ytrue = max(y); xtrue = min(x); flag = 2; elseif (0 > (i-theta) && (i-theta) > -pi/2 ) ytrue = min(y); xtrue = max(x); flag = 3; elseif (-pi/2 > (i-theta) && (i-theta) > -pi) ytrue = min(y); xtrue = min(x); flag = 4; end Where theta is the angle of the robot with the y -axis and i is the iteration of the for loop since for every position of the robot I must draw a number of rays spanning 180 degrees (i ranges from 0 to pi/2). The prob...

Hi, I am new to simulink and embedded matlab function, I am trying to create a block which I will connect it to another block, so I should have an output of it... the first version of my block is like that: function y=questionI1(vals) %#eml eml.extrinsic('bit_gen'); eml.extrinsic('view_data'); eml.extrinsic('stem'); eml.extrinsic('AXIS'); eml.extrinsic('title'); eml.extrinsic('sgnl_prm_gen'); eml.extrinsic('bit2int'); eml.extrinsic('int2symb'); eml.extrinsic('pam_encoding'); eml.extrinsic('plot'); eml.extrinsic('figure'); eml.extrinsic('rec_filt_dsmp'); eml.extrinsic('eye_diag'); eml.extrinsic('hold on'); eml.extrinsic('ML_decision'); eml.extrinsic('int2bit'); %Assigning of entry values p0=vals(1,1); A=vals(1,2); sf_b=vals(1,3); nbits=vals(1,4); M=vals(1,5); %Generate random bits bit_vec = bit_gen(nbits,p0); %Display 5 element binary sequence % view_data(bit_vec,100,5,'samp',vals(1,3),'Binary sequence'); % plot([100:104],bit_vec(1,[100:104])); % bit_vec=bit_vec(1,100:104); figure(1); stem(bit_vec); AXIS ([99.5 104.5 0 1.2]); title('Binary sequence'); % Generate a modulated signal vector [ak,h,sf] = sgnl_prm_gen('ASK',M,'NRZ',sf_b); int_vec = bit2int(bit_vec,M); symb_vec=int2symb(int_vec,ak); pam_vec = pam_encoding(symb_vec,A,h,sf); % Display 5 element NRZ coded sequence % view_data(pam_vec,100,5,'...

I'm working through ch. 10 in Mastering Simulink, and noticed that they only cover Level 1 Matlab S-Functions, although Level 2 seems to be state of the art. Can anybody recommend someplace good to read up on that? TIA Type >> sfundemos at the MATLAB command line. It gives examples of many different types of S-Functions. The next best place to start is with the S-Function documentation. Phil. ...

Hey all, I am having problem in soft handover implementation with MATLAB please help me out. It is my final dissertation .I am unable to do this. ..pls mail me at nikhilpatel0786@gmail.com Thank you very much... Please helpp "vpmp patel" <mecs@yahoogoups.com> wrote in message news:jkh46d$i9m$1@newscl01ah.mathworks.com... > Hey all, > I am having problem in soft handover implementation with MATLAB > please help me out. It is my final dissertation .I am unable to do > this. Then you need to talk to your dissertation advisor first; if he or she can't give you enough help, post SPECIFIC DETAILS about the problem you're experiencing with your implementation and ask a SPECIFIC question and someone may be able to offer some suggestions. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

I am new to this function. Hope somebody can tell me the idea how to implementate this function inside DSP using C language. Great Thanks! Try the FAQ on the dspguru site www.dspguru.com I got it. Thanks ...

Hello, Isnt 'unquant' and 'soft' options essentially same?..in both case vitdec takes in "real numbers" as input (ok they are "mapped" in case o 'soft' option)..so can we not use 'unquant' option to carry out sof decoding?...my preliminary results show that 'unquant' option give me 2- db gain over hard decoding... any one having insight please let me know. thanks >Hello, > Isnt 'unquant' and 'soft' options essentially same?..in both cases >vitdec takes in "real numbers" as input (ok they are "mapped" in case of >'soft' option)..so can we not use 'unquant' option to carry out soft >decoding?...my preliminary results show that 'unquant' option give m 2-3 >db gain over hard decoding... >any one having insight please let me know. >thanks > > %%% Yes , u can use 'unquant' as soft decoding. try to implement for k=3 i.e [5 7] and BPSK and at roughly 4 dB u should get BER of 10^-3. Chintan ...

I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked. Thanks to the contribution from above! ...

Hello, Does the code below obey the ISO/IEC 9899:1999 Standard? #include <stdio.h> #include <stdlib.h> int main(void) { int a = 10; void print() { printf("a = %d\n\n", a); } print(); return 0; } Thanks in advance, Vinicius. CViniciusM wrote: > Hello, > > Does the code below obey the ISO/IEC 9899:1999 Standard? > > #include <stdio.h> > #include <stdlib.h> > > int main(void) > { > int a = 10; > > void print() > { > printf("a = %d\n\n", a); > } > > print(); > > return 0; > } > > Thanks in advance, Vinicius. This is not instant messaging. You have to wait to get answers before re-posting your question. On my news server, I can see that your question has already been answered - more than once. Here's the answer once more: No. C does not allow nested function definitions. -nrk. -- Remove devnull for email CViniciusM wrote: > Hello, > > Does the code below obey the ISO/IEC 9899:1999 Standard? An hour and a half _before_ you reposted this, Joona Plaste and Lew Pitcher answered you. Didn't you like their answer, or do you not bother to check the newsgroup for answers? Just in case the last is true (even though absurd) I have e-mailed this as well. BTW: the answer is still *NO*! I wrote wrong, "Is the code below..." instead of "Does the code below"...

Folks, I suck at OS/2, and this guy has a problem. Config.sys has been changed. Any way to boot in recovery mode? No further info yet, unknown if this was a result of a FixPack, adapter install, or a program update. Challenge, this may be a production unit, and it may be doing involved things. -------- Original Message -------- Subject: Trouble with a Personal System/2 Date: Thu, 30 Sep 2010 20:40:20 -0400 From: <brian@centralindianapatternandmold.com> To: <ohland@charter.net> please help . config.sys got changed os2 ibm indurstial computer-will not boot? In article <npapo.23064$qU5.8268@newsfe20.iad>, Louis Ohland <ohland@charter.net> wrote: > Folks, I suck at OS/2, and this guy has a problem. > > Config.sys has been changed. > > Any way to boot in recovery mode? No further info yet, unknown if this > was a result of a FixPack, adapter install, or a program update. > > Challenge, this may be a production unit, and it may be doing involved > things. 1. Boot (C-A-D). 2. Wait for "boot blob" at top left corner of the screen (a white box, and "OS/2"). 3. Press Alt-F1. 4. Select "Boot to command prompt (use original CONFIG.SYS)" option. 5. Fix the CONFIG.SYS Alternatively, boot to command prompt from the OS/2 installation diskettes. -- Don Hills (dmhills at attglobaldotnet) Wellington, New Zealand "New interface ...

All information about computer Soft & Hardware. visit:www.santoshcomputer.blogspot.com ...

Hi, I have a question about random variable distribution. Please help me if you could. We know x and y are independent normal random variables. "a" is a constant between 0 and 1. We want to know the distribution of a*(x^2)+(1-a)*(y^2). From probability text books, it is easy to know that the sum of two independant normal RVs'(They, RVs, have the same mean and variance) square is chi-square distribution. For my question, they are weighted with "a" and "1-a". I have no answer. Anyone can tell me? Thanks in advance. <freelait2000@yahoo.com> wrote in message news:1114614159.697192.233910@z14g2000cwz.googlegroups.com... > Hi, > I have a question about random variable distribution. Please help me if > you could. > We know x and y are independent normal random variables. "a" is a > constant between 0 and 1. We want to know the distribution of > a*(x^2)+(1-a)*(y^2). From probability text books, it is easy to know > that the sum of two independant normal RVs'(They, RVs, have the same > mean and variance) square is chi-square distribution. For my question, > they are weighted with "a" and "1-a". I have no answer. > > > Anyone can tell me? Thanks in advance. > Your mean stays the same and your variance of the sum is goes up by a^2+(1-a)^2 so up by 2a^2-2a+1 as far as I can tell. Best of luck - Mike freelait2...@yahoo.com wrote: > We know x and y are independent...

Hi there! After I overcame some short_open_tag (thanks, Rik!) I encounter another strange php-behaviour. The script I just got to work on the windows-commandline obviously does as php.ini tells php to do and loads php_mysql.dll: E:\ersDHCP>php ./extractLog.php .... some mysql-stuff, some output, OK The same script invoked by the webserver apache 2.2 entails an error: http://localhost/extractLog.php PHP Fatal error: Call to undefined function mysql_connect() My configuration php.ini does contain the line extension=php_mysql.dll and seems to be OK while I use the script from commandline. Is there anybody who can give me a hint where to cope with this error? Take care, Christian ...

This is what I have so far and the last local function I have no idea how to work out.: function sortedarray=arraySort(array) sortedarray={}; while ~isempty(array) [m,pos]=loc_findSmallest(array); sortedarray=[sortedarray m]; array=[array(1:pos-1) array(pos+1:end)]; end function [m,pos]=loc_findSmallest(array) %This function takes as its input a vector and %gives as its output the smallest value in that %vector and its position. m=array{1}; pos=1; for i=2:length(array) if loc_isLessWord(array(i),m) m=array(i); pos=i; end end function isLess=loc_isLessWord(a,b) %this function will determine whether or not a is %less than b i=1; while i<length(a)&&i<length(b)&&a(i)==b(i) i=i+1; end if stra==97 isless=true; elseif strb==97 isless=false; elseif stra==122 isless=false; elseif strb==122 isless=true; elseif stra>97 && stra<122; strb<stra; isless=false; elseif strb>97 && strb<122; stra>strb; isless=true; end "Sonya " <sonyammobley@aol.com> wrote in message news:j9uilf$hkj$1@newscl01ah.mathworks.com... > This is what I have so far and the last local function I have no idea how > to work out.: *snip* Please don't ask your entire question in the subject line, or if you do please copy it to the body of the message as well. The original question was "I need to write a function with loc...

Thanks Laki, ur answer could be right if I apply the effect of the channel to the signal then i add the noise, but what i do is adding the noise efect first then applying the channel effect to the sum (signal+noise), to get channel*(signal+noise), so after equalization i'd have ---> (channel*(signal+noise))/channel -- > signal+noise. hope u got what i mean .! thanks alot Laki for ur participation Hany Hany That's an interesting way to model the system, but i'll come back to that. What I think you're trying to do is this H*S / H_est = S where H = channel and H_est is the channel estimate (therefore inv(H_est) represents the inverse channel which you're calling an equaliser). Now, have you tried looking at the result of simply convolving the channel and the equaliser? H / H_est = 1 What do you get out of this? If that is difficult to obtain, then can you substitute the signal S for an impulse function (no noise) and examine the signal at the output of the equaliser? What do you get? The reason i say that it's an interesting way to model the system, is because you seem to be adding noise prior to the channel. One form of noise is typically added to model the thermal noise effects at the receiver. What you're doing it seems is receiving the signal noiselessly and are adding noise at the output of the transmitter. Now, this may not be a bad thing, because you could be trying to model some form of interference, but you haven&...

http://mycarta.wordpress.com/2012/04/05/visualization-tips-for-geoscientists-matlab-part-ii/ ...

I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') This should work as well, but I am not sure how well it degrades in older browsers. I think there are issues with functions created in another context (eg frame) as well. (cb instanceof Function) Then I came across this. (!!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /function/i.test( fn + "" )) I'm sure it is wrong as it is from jQuery, but it makes me wonder if there are bugs in older browsers that will mislead my test. As an aside, I was looking at the jQuery source as some browser sniffer I was arguing with on a blog cited it as part of an "everybody is doing it" argument. I had glanced at it previously and dismissed it based on its resemblance to Prototype. Upon closer inspection, it makes Prototype look inspired. Suffice to say that anybody who recommends it hasn't read the code. It's a horror show. On Sep 25, 7:09 pm, David Mark <dmark.cins...@gmail.com> wrote: > I've got a collection of functions that accept a function or object > (paired with a method name) as a callback. > > For the longest time I have relied on this test. > > (typeof cb == 'function') > > This should work as well, but I am not sure how well it de...

Hi, Here is the screenshot of my GUI: http://i54.tinypic.com/iemg7o.png In the pushbutton1 of File Path which has Browse written over it, I have used the following code: function pushbutton1_Callback(hObject, eventdata, handles) [FILENAME, PATHNAME] = uigetfile; And in the pushbutton2 which has Send! written over it, I have used the following code: function pushbutton2_Callback(hObject, eventdata, handles) input_sec_info=get(handles.edit1,'String'); Encoder(input_sec_info,FILENAME, PATHNAME); Now that the pushbutton2 passes input_sec_info,FILENAME, PATHNAME as arguments to Encoder function. But the FILENAME, PATHNAME are deleted as they are a part of another function. So, when I click the pushbutton1, the variables FILENAME, PATHNAME are created and saved. But when I click the pushbutton2, the variables FILENAME, PATHNAME are deleted because they are part of someother function. But I need all 3 variables including input_sec_info,FILENAME, PATHNAME. So, is there anyway that I can save variables FILENAME, PATHNAME and use them later. I know how to save it in .mat and recall it but it makes the GUI very un-friendly (because it opens up other dialog boxes for saving .mat file even if you give it the .mat file name to be saved with). Is it possible to do it through the code? Thank you. "Asad Asad" wrote in message <itsaou$1sh$1@newscl01ah.mathworks.com>... > Hi, > > Here is the screenshot of my GUI: > > http://i54.tinypic.com/iem...

Hi, Is there any way to do remove a few lines from a paragraph using regexp functions? Something like : sed -e '/temp/,/test/d' text.txt ? This is what I need: select 'text' title from dual union select 'test' from dual union select 'temp' from dual union select 'doc' from dual; TITLE -------------------------- doc temp test text Required Output after running regexp functions: TITLE -------------------------- doc text ie., remove anything between 'temp' and 'test' (inclusive) ... Thanks -Ad Na Thu, 06 Aug 2009 13:40:31 -0700, admin wrote: > Hi, > > Is there any way to do remove a few lines from a paragraph using regexp > functions? > > Something like : sed -e '/temp/,/test/d' text.txt ? What do you mean by "remove few lines from a paragraph"? Single LOB variable needs to be edited? Few lines being, in fact, few records? Oracle functions usually operate on database variables like column values etc. Where do lines fit into that context? -- http://mgogala.freehostia.com On Aug 6, 4:40=A0pm, admin <ad...@rbtron.com> wrote: > Hi, > > Is there any way to do remove a few lines from a paragraph using > regexp functions? > > Something like : sed -e '/temp/,/test/d' text.txt ? > > This is what I need: > > select 'text' title from dual union select 'test' from dual union > select 'temp' from dual union sel...

hi, I am talking about product SAS,using SAS how do i fit any distribution for a given random variable in sas.If a random variable is given what are the tests i should do in sas to see which pattern it follows . One more is that if i know a given variable follows Poisson distribution suppose, then how do i fit that distribution,how do i find expected frequencies and verify with theoretical frequencies,what are the goodness of fit tests done ...

Hey all, I'm trying to convert a .m file into something usable by a user defined function block in simulink but am having trouble with the following style of equation: x = exp([-y:y]); where y is an integer which normally has a value between 40 and 120. Running this through simulink results in the following error: ------------------------------------------------ Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. Function 'testing.m' line 8, column 14: "[-y:y]" ---------------------------------------------------- I know simulink doesn't like variably sized arrays/matrices but I'm not sure I can set an upper bound in this case since it's referring to the operation itself rather than x or y. Anyone know of a potential work around for this? Cheers. What sort of user defined function: Embedded MATLAB, S-Fuction, MATLAB Fcn Block? Is y and input? Is x an output? Or are they local variables? Phil. "Phil Goddard" <phil@modeling-simulation-visualization.com> wrote in message <j020k4$gkv$1@newscl01ah.mathworks.com>... > What sort of user defined function: Embedded MATLAB, S-Fuction, MATLAB Fcn Block? > > Is y and input? > Is x an output? > Or are they local variables? > > Phil. Sorry should have been more clear. It is an Embedded Matlab Function block, x and y are just local v...

Hi, I am using Matlab S-Function Builder for some my legacy C code in Simulink. Because in my C code, several varables modified, I would like to transfer these varables in their reference. To my surprise, Matlab build process always complaint error. These codes using reference has passed in Microsoft C. Thus, I don't think it is a programming problem. mex also supports MSVC. Why I cannot transfer reference in function call? I would like to know are there better methods to transfer multiple varables back to callee? Using structure? Thanks a lot. ...

I have a c-mex s-function file in which I have written several custom functions. I have no problems printing to output files from most of these custom functions, but the one below continually crashes Matlab whenever I try to print to file from this function. This is odd, because, from what I can see, the syntax below follows that used in all of my other custom functions, so I'm not sure what's going wrong. Can anyone spot the problem with the code below, that causes Matlab to crash when the write-to-file statements are active? (When I comment those lines out, the function runs without crashing, although I suspect that this function is generating the wrong values, which is why I need to view them.) ------------------------------------------------------------------- static void mdlRLgetState(SimStruct *S){ FILE *out1; real_T *Dwork_ShAng = (real_T*) ssGetDWork(S,0); real_T *Dwork_ElbAng = (real_T*) ssGetDWork(S,1); real_T *Dwork_state0 = (real_T*) ssGetDWork(S,48); real_T *Dwork_state1 = (real_T*) ssGetDWork(S,49); /* it also crashes if I declare FILE *out1 here, instead */ out1 = ("AA_mdlRLgetState.log","a"); Dwork_state0[0] = Dwork_ShAng[0]; Dwork_state1[0] = Dwork_ElbAng[0]; fprintf(out1, "Dwork_state0[0] = %f, 1 = %f \n", Dwork_state0[0],Dwork_state1[0]); fclose(out1); } /* mdlRLgetState() function */ ---------...

Hello , anybody knows when I execute the function "regress" to this model (STAR(1)) Yt = 1 - 0-5Yt-1 - (4 + 0.4Yt-1)G(gamma*Yt-1) + et, where G(z) =1/ [1 + exp(-z)], gamma=4; et=N(0,1) I obtain different radically different results from matlab 6.5 to matlab 7.0 that with other models??Any suggestion to avoid this problem??? On May 25, 4:40=A0am, "Kun Aguero" <isildur20022...@yahoo.es> wrote: > Hello , anybody knows when I execute the function "regress" to this model= (STAR(1)) > Yt =3D 1 - 0-5Yt-1 - (4 + 0.4Yt-1)G(gamma*Yt-1) + et, where G(z) =3D1/ [1= + exp(-z)], > gamma=3D4; > > et=3DN(0,1) > I obtain different radically different results from matlab 6.5 to matlab = 7.0 that with other models??Any suggestion to avoid this problem??? Please show the relevant code. Hope this helps. Greg Well,I have made several tests and this is the result: -When I use the function regress in this format in matlab 6.5, it works: [B1,BINT1,R_X,RINT1,STATS1]=regress(X(2:length(X))',[ones(length(X)-1,1),X(1:length(X)-1)']); -When I use the same format in matlab 7.0 it doesn't works, but if I use this format: [B1,BINT1,R_X,RINT1,STATS1]=regress(X(2:length(X))',X(1:length(X)-1)'); It works in matlab 7.0. Then I think the problem is how the function regress treats the independent term in both versions?? regards Greg Heath <heath@alumni.brown.edu> wrote in message <69879944-34b7-4262-a193-0bb545d8cf99@...

This work is in the public domain in the United States because it is a work prepared by an officer or employee of the United States Government ...

Last month, Marshmallow finally reached a full percentage point in the Android distribution numbers. In March, helped by numerous OEMs releasing ...

If you are a big GNOME fan like me then there is one distribution you must try Fedora. The Linux-based operating system the same that Linus Torvalds ...

WASHINGTON (AP) — A Washington man accused of selling marijuana to an undercover officer has pleaded guilty to marijuana distribution charges. ...

The animated film The Little Prince , which has performed well overseas and was a record-breaker in France where it won the Best Animated Film ...

So, February is gone, and as such, the Mew distribution event by way of GameStop cards is too. Now Celebi is up on the mythical chopping block, ...

It’s been a while since we reported on Robert Hamilton’s upcoming film The Suffering (official website), but now we can finally break that silence, ...

Google updated its Android distribution numbers for the month of March, showing slight growth in the Marshmallow department. After just barely ...

Attackers manage to breach Linux Mint's security, adding a backdoor to the distribution and even stealing information from user forums.

How mutual fund distributions affect your tax cost depends on what you do with them.

Resources last updated: 3/30/2016 10:37:04 PM