Answered
Why it shows error (NRZ encoder) : "Vectors must be the same lengths in plot(t,s)."
The length of t is 10001 while the length of s is 11000 Instead of |t=0:sampTime:10| you should writte t=0:sampTime:endTi...

14 years ago | 1

| accepted

Answered
Complex numbers in matlab
I assume That a complex number is stored as two numbers: real part and imaginary part

14 years ago | 0

Answered
radix 2 disspation in frequency
x=rand(1,8); % Example xo=x(2:2:end); % odd part xe=x(1:2:end); % even part for N=0:3 for k=0:3 Xo(k+1)=x...

14 years ago | 0

Answered
generation of permuted matrix
A=1:120; %your data for k=1:10 [idx,idx]=sort(rand(1,120)) out(k,:)=A(idx) end

14 years ago | 0

| accepted

Answered
How to change matrix dimensions?
[n,m,p]=size(A) b=reshape(A,n,p*m) idx=reshape(1:p*m,m,p)' out=b(:,idx(:))

14 years ago | 0

Answered
How to Converting sine wave to a square wave in stateflow without invoking simulink function?
If you need a time value, in your Simulink model, add a *clock* block from *Simulink/Sources* and connect it as an input to your...

14 years ago | 0

Answered
How to obtain statespace having two inputs from transfer function in matlab mfile
Use *tf2ss* to find |A,B,C,D| , change B to add any inputs you want, then rebuilt a newmodel with *ss* function a=1;b=2;c...

14 years ago | 0

| accepted

Answered
How do I calculate the frequency of repeated/unique values?
A=[A1 B1]

14 years ago | 0

| accepted

Answered
Split array values into 2 elements
out=str2num(reshape(num2str(A')',3,[])')'

14 years ago | 1

Answered
How to change the sample time?
For each signal use one scope with it's sample time

14 years ago | 0

| accepted

Answered
How to set simulation to calculate every one second time
click on Simulation - Configuration parameters-Fixed step size to 1 or if you can't find just type in Matlab command set_pa...

14 years ago | 0

| accepted

Answered
Specifying a function that is discontinuous?
t=-10:0.01:10; y=zeros(1,numel(t)); y(t>=0 & t<=5)=1 %or you can use heaviside function t=-10:0.01:10; y=heaviside...

14 years ago | 0

Answered
delete rows in Matrix 'A' with same values 'c' in column 'b'
b=3; c=[2 4] idx=any(ismember(A(b,:),c)); if idx==1 A(b,:)=[] end

14 years ago | 1

Answered
index of a mnatrix to negative
You can use positive index to represent negative index. for example if you have to compute |y(k)=sin(k) for k=-3:10| for ...

14 years ago | 0

Answered
Simulink/Differential Equation question with unit step inputs
Use a transfer function block from simulink/continuous, and set Numerator and Denominator block: N=[1] D=[1 2 1] If y...

14 years ago | 0

Answered
Inner matrix dimensions must agree. error
As you said in your question, in your delay block you must set initials conditions to *x0* and *P0*, where |x0=zeros(n,1)|; *n* ...

14 years ago | 0

| accepted

Answered
simple fft code problem
%k and m start at |0| x=rand(1,8); for k=0:7 for m=0:7 l(m+1)=x(m+1)*exp(-i*k*m*pi/4); end X(k+...

14 years ago | 0

| accepted

Answered
Setting condition for a variable in an iteration loop
use if z>0 & z<1

14 years ago | 0

Answered
plot differential equation (ODE)
It's not |y=zeros(length(x))| but |y=zeros(1,length(x))|;and dont use i ( reserved to complex numbers) x=0:1:20; y=zer...

14 years ago | 0

Answered
is possible use some function to find derivatives of a vector?
*Edit* NO2=[1.1 2.4 3.3 4.7 5.9 6.0] Z=[4.5 6.2 8.4 10.3 12.5 14.8] d1=diff(NO2)./diff(Z) d2=diff(NO2,2)./diff(Z(2:end))...

14 years ago | 0

Answered
solving trigonometric equations problem
syms x s = solve(cos(x)-0.5)*180/pi

14 years ago | 0

Answered
how can i plot a rectangular train wave ???
You can use the function *square* which generate a *2pi* periodic square wave signal w=50 % positive signal ...

14 years ago | 0

Answered
How can I use a triggered subsystem in a loop?
You said that the trigger for the Subsystem depends on the output of the Triggered Subsystem, which requires a unit delay block....

14 years ago | 1

Answered
Loading a mat file consisting a variable
for k=1:4 data=load(sprintf('des%d',k)) end |data| is a struct variable, if file |des1| contains one variable b, to get ...

14 years ago | 0

Answered
filling a vector up with a second one
a=[0;0;0;0;0;5;5;5;4;4] b=[1;1;1;4;4;5;5;5;6;6;9;9;10;10;10;11] idx=find(~a); a(idx)=b(end-length(idx)+1:end)

14 years ago | 0

| accepted

Answered
import variables from Base Workspace into Simulink model
use *To Workspace* block from *Simulink/Sinks* In the block properties, give a name to your variable, by default it's *simou...

14 years ago | 0

| accepted

Answered
How can I replicate matrix
p=1:25 a=repmat(p,25,1) out=[a(:);ones(15,1)*p(end)]

14 years ago | 0

| accepted

Answered
Arrange a matrix with repeated rows
a = [125 97;126 104;97 125;5 4;104 126;97 125;4 5]; b=cell2mat(arrayfun(@(x) sort(a(x,:)),1:size(a,1),'un',0)') [~,idx]=so...

14 years ago | 0

Answered
Error while using different step size
Pat your *step1* block *sample time* is set to *0.8*, change it to *-1*

14 years ago | 0

Answered
Delaying the Signal in simulink
<<http://azzimalikcom.ipage.com/ansf270.jpg>> use as threshold >=1

14 years ago | 0

| accepted

Load more