Answered
How to change the sign of a whole vector?
plot(abs(A))

12 years ago | 0

| accepted

Answered
Average in a summation
You did 2 errors X=rand(10,1); Y=rand(10,1); sum((X(1:end-1)+X(2:end))/2.*(Y(2:end)-Y(1:end-1))) sum instead of Sum ...

12 years ago | 0

Answered
Summation, Please help i will buy you a cookie :D
Have you checked the length of v? Don't use sum as variable (sum is a Matlab built-in function) When you write a=10 ...

12 years ago | 1

Answered
using ode15s to solve differential equations
You have a problem in the first line function ode15s =(t,y) Read the documentation about ode15s doc ode15s

12 years ago | 0

Answered
vectorize a loop with product and sum operations
x = 1:4 v = rand(1,10) out1=bsxfun(@times,repmat(v,4,1),x') out=bsxfun(@plus,out1,x') %OR x = 1:4 v = rand(1,10) ...

12 years ago | 0

Answered
How to set the sample time of a subsystem?
Try a zoh block just before your subsystem and set sample time of your subsystem blocks to inherited Add If your subsystem doe...

12 years ago | 3

| accepted

Answered
i have doing fourier transform of sine wave. I am given amplitude 5v. but at the fft it not shows the 5v amplitude. so please help me.
First, there is an error in your last line, because length(xDFT)/2 is not always an integer, use instead Y=abs(xDFT(1:fix(n...

12 years ago | 0

Answered
Can we call a m-script during model simulation ?:
You can control your simulink model from a script file set_param('modelname', 'SimulationCommand', 'start') % To start your...

12 years ago | 0

| accepted

Answered
How i can open a file that is written using matlab 2013 by using matlab 2009?
You can open it as any text file. You can run your m-file if all functions used in your file exist in your previous version of M...

12 years ago | 0

Answered
Trimming rows based on values in one column
A=[5 0 5 0 5 1 5 1 5 1 6 1 7 0 8 0 9 0 9 0 1 1 3 1 2 1 4 1 44 1 5 0 4 1 3...

12 years ago | 0

Answered
How to load multiple .mat files into workspace in order to concatenate matrices and calculate mean
M=zeros(11,11,10) % for 10 files p=0; for k=201:210 p=p+1; A=load(sprintf('%d.mat',k)); s=fields(A...

12 years ago | 0

Answered
construc a string from other strings and variables
If fil_nam is a cell array fil_nam = {subj '_b' band '_d' ndip '_s' nroi} out=strjoin(fil_nam)

12 years ago | 0

Answered
Plotting of output responses
If y1 and y2 are your two output plot(y1,'r') hold on plot(y2,'b') hold off

12 years ago | 0

Answered
how to save/write images using for loop?
for i=1:10 imwrite(x,sprintf('%d.jpg',i)) end;

12 years ago | 12

| accepted

Answered
Matlab Simulink power supply
If you have an idea about the fluctuations, they are probably aleatory. You can use a random source, like a <http://www.mathwork...

12 years ago | 0

Answered
Convert transfer function in state-space model question
Laurentiu, The state space representation is not unique, you can get an infinite number of state space representation, depending...

12 years ago | 1

Answered
RECURSION FUNCTION IN MATLAB USING ARRAY
n=[1 2 3 4 5 6 7 8 9 ...100]; n1=n; while numel(n1)>1 % do % n1= % n=n1 end

12 years ago | 0

| accepted

Answered
Multiply a cell array with a scalar
yournumber=2; a={[1 2 3],[2 5;6 8], [2 5 8 7]} cellfun(@(x) x*yournumber,a,'un',0)

12 years ago | 14

| accepted

Answered
Dont see why this code doesnt work
Use |pipeCost(i,:)| instead of |pipeCost(i)| z=rand(1,11) price1=1; price2=2 for i=1:11 x = z(i)/0.9; pipeLeng...

12 years ago | 0

Answered
How to estimate transfer function from step responses
When we look at your step response, it's obvious that your model is not linear, there are some saturation at the beginning of yo...

12 years ago | 2

| accepted

Answered
replace the unique value of a vector
a=[2;3;3;5;5;5]; c=unique(a); ii=histc(a,c) [idx1,idx1]=min(ii) [idx2,idx2]=max(ii) minv=c(idx1) maxv=c(idx2) b=a b(a=...

12 years ago | 0

| accepted

Answered
Equations, scalars, and matrices
You can use .^

12 years ago | 0

| accepted

Answered
create a new variable whos name is conditional
Look at this link <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F> You can d...

12 years ago | 0

Answered
How to choose a column where the min of the first row is
a = [ 5 4 1 3 ] b = [ 1 2 3 4 ] [mina,idx]=min(a); your_column=[mina;b(idx)]

12 years ago | 0

Answered
Form a matrix with specific day types
M={'01/01/2013' 2 'a' '01/02/2013' 3 'b' '01/03/2013' 4 'c' '01/01/2013' 2 'a' '01/02/2013' 2 'b' '0...

12 years ago | 0

| accepted

Answered
How to read pairs of data from a text file?
A=[-0.00049249 0.000252263 0.000674042 0.000829539 0.000820268 -0.00049555] B=reshape(A,2,[])' To read your text file yo...

12 years ago | 0

| accepted

Answered
Solving differential equations using ODE15s
I think what you are doing is not correct. Read the documentation,there are many examples there <http://www.mathworks.com/hel...

12 years ago | 0

Answered
IF / ELSE Usage within For loop for Specific Iteration Only
for i=1:1:15 if ismember(i,[9 10 12 14]) % do end

12 years ago | 2

| accepted

Answered
How to detect curved lines
If you have a Signal Processing Toolbox you can use <http://www.mathworks.com/help/signal/ref/findpeaks.html findpeaks>

12 years ago | 0

Load more