Answered
create vector that consists only of zeroes
It's not zeroes, it's zeros error=zeros(length(data13(:,1)),1) %or zeros(size(data13,1),1)

13 years ago | 1

Answered
How do I take the derivative of my plot?
dy=diff(y)./diff(x) plot(x(2:end),dy)

13 years ago | 14

| accepted

Answered
Please help with insights
n=[16,18,23,24,39,40] find(cumsum(n)>=100,1) %or a=0; k=1 while a<100 & k<numel(n) a=a+n(k); k=k+1; end ...

13 years ago | 0

Answered
How to convert a vector to a row of a matrix and resize it at the same time in a special situation?
A=[1 2 3] B=[5 5 5 5 5 5 5 5 5;0 0 0 0 0 0 0 0 0;4 4 4 4 4 4 4 4 4] n=size(B,2) id=fix(n/3); B(2,id:id:n)=A

13 years ago | 1

Answered
How can I find an element in a subset of a matrix as well as its index in the matrix?
Example A=randi(2,10)-1 [ii,jj]=find(~A(1:3,1:3)) index=sub2ind(size(A),ii,jj)

13 years ago | 0

Answered
generate function and save it
When you type triarea(1,2) What is the error message?

13 years ago | 0

Answered
Random numbers seed setting
Use a=rng; out=randn rng(a) out=randn

13 years ago | 0

| accepted

Answered
How can I know what variable time step the Simulink has taken and use it in workspace?
I'am not sure to understand your question, maybe you should use the clock bloc from simulink/sources to get the time at each ste...

13 years ago | 0

Answered
How to fill a matrix with a range of numbers?
A=reshape(1:10,2,[])'

13 years ago | 2

| accepted

Answered
creating an array from an object
s={'cats' 100 200 300 100 'dogs' 50 100 110 80 'mice' 80 30 40 200} out=s(cellfun(@isstr,s))

13 years ago | 0

Answered
How to manipulate 2 matrices and form a third matrix
a = [1 2]; b = [0.25 0.5]; for k=1:2 for p=1:2 c(k,p)=a(k)/b(1)+a(p)/b(2) end end

13 years ago | 0

Answered
call consecutive variables for loop
It's not num2string but num2str. Also it's not a good idea to use eval

13 years ago | 0

Answered
How do I find all the positive roots of (e^(-.2x ))(cos(2x))-.15x^2+1
syms x, y=exp(-.2*x )*cos(2*x)-.15*x^2+1 sol=solve(y)

13 years ago | 0

| accepted

Answered
how can i enter this question in a script file using the if,elseif and else statement?
look at <http://www.mathworks.com/help/matlab/ref/if.html>

13 years ago | 0

Answered
which simulink block to use in the model?
If you have some calculations to do use matlab function bloc or interpreted matlab function bloc

13 years ago | 1

| accepted

Answered
How can i call a Simulink function in a stateflow?
Look at <http://www.mathworks.com/help/stateflow/ug/how-to-define-a-simulink-function-in-a-stateflow-chart.html>

13 years ago | 0

| accepted

Answered
how can i send constant input values to workspace from simulink model?
If you are using a constant block, it's more logical if you define your constant c in windows command or in your m-file which yo...

13 years ago | 1

| accepted

Answered
Initial value in a A*x=b system equation
Pass y1 through a unit delay bloc with initial value set to your initial value

13 years ago | 0

Answered
How can I solve two nonlinear equations?
syms x1 x2 a b c d th solve(x1+x2-(a-b*cos(th)), x1^2+x2^2-(c-d*cos(th)),x1,x2)

13 years ago | 0

| accepted

Answered
How to write specific rows and columns to excel sheet
% If A is your matrix B=A(3000:6000,:) xlswrite('yourfile.xls',B)

13 years ago | 0

Answered
Why y is a complx number? y = x.^(2/3)
use y=abs(x.^(2/3)) You are calculating the roots of negative numbers, they are obviously complex (-10)^(2/3) ...

13 years ago | 1

| accepted

Answered
how many function within a simulink block (matlab function block) i can define.
You can use more than one matlab function block in simulink

13 years ago | 0

Answered
What is a function that takes the diagonal of a matrix (N) and converts the diagonal to all zeros.
ii=1:size(m,1); m(sub2ind(size(m),ii,ii))=0

13 years ago | 0

Answered
Unique Function based on 2 columns [Instead of rows]
b=a{1} c=b(:,3:4) [~,idx]=unique(c,'rows','first','stable') out=b(idx,:)

13 years ago | 2

| accepted

Answered
Plz explain the operation
Read a cell raw from an Excel file then replace all numeric values, nan and empty element by ' '

13 years ago | 0

Answered
splitting a array at defined interval
ii=1; for k=1:numel(vind) jj=vind(k) out{k}=c(ii:jj) ii=jj+1; end

13 years ago | 1

Answered
How to divide Vectors of different length?
a=linspace(1,16,16); b=linspace(1,4,4); d=reshape(a,[],numel(b)) out=bsxfun(@rdivide,x,b) c=out(:)'

13 years ago | 0

Answered
How to put degree symbol in x-axis
xt=get(gca,'xtick'); for k=1:numel(xt); xt1{k}=sprintf('%d°',xt(k)); end set(gca,'xticklabel',xt1);

13 years ago | 1

| accepted

Answered
Unique Function based on 2 columns [Instead of rows]
b=a{1}; out=all(~(any(diff(b(:,3:4)))))

13 years ago | 1

Answered
How to sum frequency of the duplicate value in an array?
[a,b]=unique(g) new_g=g(sort(b)) new_h=arrayfun(@(x) sum(h(g==x)),new_g)

13 years ago | 0

Load more