Answered
Change constant during simulation in Simulink
Look at set_param function

13 years ago | 1

Answered
how to split matrix by percentage
%----Example------- n=randi(100); m=10; R=rand(n,m) %--------------------- n1=ceil(0.1*n)

13 years ago | 0

Answered
How to calculate average in a large matrix?
%Example-------------- A=rand(10) p=3 %----------------------- [n,m]=size(A); q=ceil(n/p)*p B=nan(q,m) B(1:n,:)=A ii2=...

13 years ago | 1

Answered
How to split a number into 10 different numbers?
n=50390 idx=sort(randperm(n,10)); out=diff([idx n]); out(1)=idx(1)+out(1); sum(out) %or in case the last number of idx ...

13 years ago | 0

Answered
how to compare two graphs in matlab?
If data are available, just compare your data, |y1==y2| will not work. Try to find when |y1-y2| is changing sign Example ...

13 years ago | 1

| accepted

Answered
How to use the index of a matrix in another one?
y=[ 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 1 0 1 0 ...

13 years ago | 0

Answered
What's wrong with the folow expression?
Use .* x=0:10 y=exp(-x)+exp(-0.5*x).*(-0.5*cos(3*x)-3*sin(3*x))

13 years ago | 0

| accepted

Answered
how to add headers to a matrix?
Why to use letters instead numbers? A=rand(10) A(2,3) % is simpler then using letters

13 years ago | 0

| accepted

Answered
How to assign two identifiers to a vector of n values.
V=[2 4;5 8] % V is a matrix not a vector i=1; j=2; V(i,j) Look at doc array

13 years ago | 1

| accepted

Answered
??? Index exceeds matrix dimensions. Error in ==> Untitled at 267 if length(W{i})==0;
Try this idx=cellfun(@isempty,W{2}{1}); W{2}{1}(idx)=[]

13 years ago | 0

Answered
is anyone know, how to know the matrix coordinate..?
In your case, you have only 1 and 0 a = [1 1 0; 0 0 0; 0 0 1;]; [ii,jj]=find(a)

13 years ago | 0

Answered
use of cosine in a function
Look at this line cos=0.5*BC/R; sin=sqrt(1-cos*cos); |cos| is used as a variable, then the function |cos| will not wo...

13 years ago | 0

| accepted

Answered
Find the index value of first and last element in the vector ?
x=[2 1 0 4 10 20 4 3 1] [~,idx_first]=min(x) [~,idx_last]=max(x)

13 years ago | 0

Answered
if at least one number > in cell
number=6.6; if all(C{1}{1}>number) W{1}{1}=C{1}{1} else W{2}{1}=C{1}{1} end

13 years ago | 0

| accepted

Answered
How to select value
clear Z=[-4:1:2]; H=[0:1:4]; [xx,yy]=meshgrid(Z,H); zz=0.4166+0.0456.*yy-0.2343.*xx; zz(zz>1)=1 zz(zz<0)=0 figure surf...

13 years ago | 0

| accepted

Answered
how i can calculate the average of the top numbers
If A is your vector b=sort(A,'descend') out=mean(b(1:8))

13 years ago | 0

| accepted

Answered
how to write an exponential eqn.
a=100 y=exp(a)

13 years ago | 0

| accepted

Answered
How to use the index ? how to drop elements from a matrix ?
b= [ 0.0913 NaN NaN NaN 0.0913 NaN NaN NaN 0.0913 NaN NaN NaN ...

13 years ago | 0

Answered
How to create a random row vector whose sum of elements and number of elements is at my desire?
*Edit* n=20; m=21; p=fix(m/n); v=randi(p,1,n); a=m-sum(v); x=zeros(n,ceil(a/n)); x(1:a)=1; v=v+sum(x',1)

13 years ago | 0

Answered
i dont know why the second figure is empty
Figure 1 was erased by figure 2 fs=20; Ts=1/fs; N=1024 Tmax=(N-1)*Ts; t=-10:Ts:10; ut=exp(-(t/10).^2); %-----figure 1...

13 years ago | 0

Answered
Transfer function of block in Simulink
Use get_param function

13 years ago | 0

Answered
Exporting to text file - adding a header
x = [1:5]; y = rand(1,5); fileID = fopen('yourfile.txt','w'); fprintf(fileID,'your text\n') for i = 1:length(x) fprin...

13 years ago | 0

| accepted

Answered
How do you replace the entry of a matrix with a string?
a=[0;1;2;3] b=num2cell(a) b{1}='Monday'

13 years ago | 0

Answered
remove the repeating values in array
a=[29 29 29 29 25 25 29 29 27; 13 13 13 13 14 14 13 13 19]; b=a' [ii,jj]=unique(a','rows') out=b(sort(jj),:)'

13 years ago | 2

Answered
Extract one element from row vectors?
A(A==max(A))=[]

13 years ago | 1

| accepted

Answered
coefficients of the variable 's'
You can't do it this way, try to write the differential equation instead of the transfer function, then use derivative blocks to...

13 years ago | 0

Answered
PlotOptions and Legend for Step Response
You can create your own plot and legend A=[-11 -10;1 0]; B=[1;0]; C=eye(2); D=[0;0]; sys=ss(A,B,C,D) [x,t]=step(sys) ...

13 years ago | 0

Answered
values in the array editor? I need to reused it again
It's preferable to save them in a mat file (right click and choose save)

13 years ago | 1

| accepted

Answered
How to get values out of an unknown structure array inside a *.mat file?
data=load('filename') variables=fields(data)

13 years ago | 4

| accepted

Load more