
#1
Jan3113, 08:39 PM

P: 2

Hiiiiii Everyone ,
It is My First Post ....And I will be Very pleased if You helped me find a solution to my problem . well... It is a Matlab code & I have different type of signals (impulse ,Ramp, sinusoidal,Dc ,exponintial ) & the type of signal is determined by the user ( the user enter a number from 1 to 5) to determine the signal & the user can have multiple selection ..& the user tells me how many time he want to select signals But The Problem i don't Know how to concatenate the signal .. I tried to make it like this A=[]; for i=1:c+1 A=[A y(choice)] end but an error keeps bothering me ??? In an assignment A(I) = B, the number of elements in B and I must be the same. please any one help me.. 



#2
Jan3113, 09:38 PM

Homework
Sci Advisor
HW Helper
Thanks ∞
PF Gold
P: 11,001

So if you are storing the possible signals in vectors m1 m2 etc, and the user constructed vector is a, then, at each selection, you are doing a=[a,m1] (if type 1 was selected).
I think your error means that you have made a mistake in your assignments to do with the vector size. Check that you are concatenating to the right place with the correct orientation. But I suspect it is the y(choice) part ... matlab would see that as an assignment of form A(I)=B you see? i.e.




#3
Feb113, 01:11 PM

P: 2

Thanks Monsieur simone For Your Help :)
But That wasnot the point that i was asking about .. You R Right you have to see the code to be able to see the problem c=input('enter the number of break point: '); for n=1:c m(1,k)=input('enter positions of break point:'); k=k+1; end p=[5 m 3]; % The signal start at 5 & end at 3 & m is the position of the break for k = 1:c+1 t=linspace(p(1,k),p(1,k+1),(p(1,k+1)p(1,k))*100); % the frequency =100 choice=menu('Choose a type','y(1)','y(2)','y(3)','y(4)','y(5)'); if choice==1 g=p(1,k+1)p(1,k); y(1)=[4 zeros(1,(g1))]; end if choice==2 y(2)=5*ones(1,t); end if choice==3 y(3)=3*t+1; end if choice==4 y(4)=3*exp(2); end if choice==5 y(5)=5*sin(100*t+30); end % Here i want to conatenate all the choosen signals & Plot it With T % But i can't Write the proper code of concatination T=linspace(5,3,(3+5)*100); A=ones(1,(3+5)*100); end 



#4
Feb113, 07:43 PM

Homework
Sci Advisor
HW Helper
Thanks ∞
PF Gold
P: 11,001

Concatinating signals on Matlabc=input('enter the number of break point: ');... you have not defined k  change the n to a k or the k to an n. With this change, the output looks like this:
if choice==1consider: what does "y(1)" mean to matlab?  what do you y to look like? if you want y to be a row vector containing the signal, then you can build it as you go. something like: y=[y,[4 zeros(1,(g1))] ]; That gets rid of the error but there are other problems. Work through your loops by hand  pick c=1 and choose 0 so that p=[5,0,3] and see what happens. Make sure it's what you want to happen. What happens if the user chooses break point positions out of order? i.e. if c=2, and the first point is 2 and the second is 1? What happens if the user chooses noninteger break point positions? I'm guessing you'll work out how to build a horizontal axis later?  [*] Shouldn't that be by Monsieur (Simon) Dupont for French? IIRC: "Simone" is the feminine spelling in French as it is in English so you are kinda implying that you think I'm a girl? Mind you  if I'm an honorary woman then I get to be "right" don't I so... no complaints there ;) It is masculine in Italian though  for "Signor (Simone) Ponte" or something(?) 


Register to reply 
Related Discussions  
MATLAB Filtering Signals?  Engineering, Comp Sci, & Technology Homework  0  
Matlab and Signals processing  Electrical Engineering  2  
Question about Using the Time Frequency Toolbox for Analysis of Signals (in MATLAB)  Electrical Engineering  1  
Matlab plotting discrete time signals  Engineering, Comp Sci, & Technology Homework  2  
Matlab Systems and Signals Problem [EE]  Engineering, Comp Sci, & Technology Homework  0 