using for loop in alignsignal function
Mostra commenti meno recenti
I am using the function [Xa,Ya] = alignsignals(X,Y). Now I want to perform this operation on an arry of X and Y's and store them on Xa's and Ya's. Any suggestions. Here X and Y will be a matrix instead of a single vector.
1 Commento
Debanjan Borthakur
il 10 Giu 2019
Risposte (2)
KALYAN ACHARJYA
il 10 Giu 2019
Modificato: KALYAN ACHARJYA
il 10 Giu 2019
%I assumed both (X & Y) have same lengths
for i=1:lengths(x)
[Xa(i),Ya(i)]=alignsignals(X(i),Y(i));
end
For example
y1=[1 2 3 4];
y2=[4 5 6 7];
x=[];
y=[];
for i=1:length(y1)
[x(i) y(i)]=fun4(y1(i),y2(i));
end
fun4
function [x y]=fun4(a,b)
x=a+b;
y=a-b;
end
If I misundestood your question, let me know.
5 Commenti
Debanjan Borthakur
il 10 Giu 2019
Modificato: Debanjan Borthakur
il 10 Giu 2019
Debanjan Borthakur
il 10 Giu 2019
Debanjan Borthakur
il 10 Giu 2019
KALYAN ACHARJYA
il 10 Giu 2019
Modificato: KALYAN ACHARJYA
il 10 Giu 2019
@Debanjan data?
Debanjan Borthakur
il 10 Giu 2019
KSSV
il 10 Giu 2019
[m,n] = size(X) ;
Xa = zeros([],m) ;
Ya = zeros([],n) ;
for i = 1:n
[xa,ya] = alignsignals(X(:,i),Y(:,i)) ;
Xa(:,i) = xa ;
Ya(:,i) = ya ;
end
If function is shown...may be it can be vectorised and work for entire matrix.
3 Commenti
Debanjan Borthakur
il 10 Giu 2019
Debanjan Borthakur
il 10 Giu 2019
Debanjan Borthakur
il 10 Giu 2019
Categorie
Scopri di più su Signal Generation, Analysis, and Preprocessing in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!