Answered
array element multiplication using arrayfun or bsxfun?
A simple way prod(1-A(:,2:9),2)

13 years ago | 0

| accepted

Answered
Different simulation results using discrete and continous systems
Why are you expecting to get the same step response for both continuous and discrete model with the same continuous proportional...

13 years ago | 0

Answered
Error keeps being displayed: "Z must be a matrix, not a scalar or vector"
x = -10:2:10; y = -10:2:10; [X,Y] = meshgrid(x,y) t = sqrt(X.^2 + Y.^2); % X,Y instead of x,y z = sin(t)./t; mesh(X,Y,z)

13 years ago | 1

| accepted

Answered
how to my indexed imgage as png file
[cdata cmap]=imread('pc.gif'); imshow(cdata,cmap)%display your image imwrite(cdata,cmap,'pc.png')

13 years ago | 0

| accepted

Answered
problem using if with two vectors
C=B idx=A<0 C(idx)=A(idx)

13 years ago | 0

| accepted

Answered
How can I vectorize this simple for loop?
ii=sub2ind(size(a),idx(:,1),idx(:,2),idx(:,3)); b =a(ii)

13 years ago | 1

| accepted

Answered
How can I index a 3D matrix using three other 3D matrices (one for each dimension)
Look at this example ux=randi(4,4,4,4) uy=randi(4,4,4,4) uz=randi(4,4,4,4) u=rand(4,4,4); idx=sub2ind(size(ux),uy(:),ux...

13 years ago | 0

Answered
How to construct this matrix without loop?
Example x=[2 4 8 12 13 19 20 25] out=cell2mat(arrayfun(@(ii) x(ii:ii+3),(1:numel(x)-3)','un',0))

13 years ago | 0

Answered
Create 3D scatter plot from matrix
A=[1.0000;10.0604; -4.6736; -1.8343] scatter3(A(2),A(3),A(4)) text(A(2),A(3),A(4),num2str(A(1)))

13 years ago | 1

| accepted

Answered
I'd like to create a loop that each time adds a new line to a .txt file.
Look at this example fid=fopen('file.txt','w') for k=1:10 my_vector=randi(4,1,4) fprintf(fid,'%f %f %f %f \r\n',...

13 years ago | 0

Answered
Converting cell array with various entry types
C ={'Eu3+' 'Eu4+' '1' '2' '10.06037350' '10.05026240' '-4.673610300' '-5.562509...

13 years ago | 0

| accepted

Answered
How to multiply two matrices together?
Notice that |A*B(1)+A*B(2)+...+A*B(n)| is equal to |A*(B(1)+B(2)+...B(n))| A = [12 62 93 -8 22; 16 2 87 43 91; -4 17 -7...

13 years ago | 0

| accepted

Answered
Problem with a slope
Maybe you should write slope = ((y1-y2)/(x2-x1)) You can notice that the origin is not in the left bottom, but in the le...

13 years ago | 0

| accepted

Answered
calling all the elements of a matrix consecutively
V = [ 1 4 9 5] for ii=1:numel(V) q=V; q(ii)=[] for jj=q

13 years ago | 0

| accepted

Answered
How do I find the values of local maximas between certain points on a graph using the "findpeaks" function?
t = 0:0.05:25; % values for time y = cos(3*t); idx=find(t>=10 & t<=20); [pks,locs] = findpeaks(y(idx)); locs=idx(locs)

13 years ago | 0

| accepted

Answered
How can I find the mean of a series of data including some 3-D points ??
Use a mean function doc mean

13 years ago | 0

Answered
Function of many input arguments returns only one value
You missed ./ n = [0 :1: 40], x = 1.0, v = sin(x + 2.^-n) + cos(3*x + 2.^-n) -(sin(x) + cos(3*x))./(2.^-n)

13 years ago | 1

| accepted

Answered
Multiply imline in one figure
h1 = imline(gca,[10 100], [100 100]); setColor(h1,[0 1 1]); h2=imline(gca,[10+50 10+50], [100 200]) setColor(h2,[1 0 0]);

13 years ago | 0

Answered
Calculating function output for more than one input variable
x = [1 4 5 10 20] y = x.^2./(sqrt(x.^2+1.0)-1.0)

13 years ago | 0

| accepted

Answered
how to find maximum value of a column,which satisfies a condition.
You can use max and min function. If M is your matrix f1=M(:,2); max_f1=max(f1) min_f1=min(f1) % you can do the s...

13 years ago | 1

| accepted

Answered
How do I enter the equation and plot points?
There is no reason this doesn't work. I guess you haven't any error message, just a mixed curve. You can sort you X data to get ...

13 years ago | 0

| accepted

Answered
Can you help me with listbox and buttons?
You can read the help of <http://www.mathworks.com/help/matlab/creating_guis/list-box-directory-reader-guide.html list box> , bu...

13 years ago | 0

Answered
stateflow action language if else construct
Look at <http://www.mathworks.com/help/stateflow/ug/what-is-matlab-action-language_bs8a3x7.html> <http://www.mathworks.com/...

13 years ago | 0

| accepted

Answered
from double to single precision
single(x)

13 years ago | 0

| accepted

Answered
plotyy two variables one with two series
Look at this example t=0:0.1:10; y=2*cos(t).^2 u=sin(t); % speed 1 v=cos(t) % speed 2 [ax,h1,h2]=plotyy(t,y,t,u) li...

13 years ago | 0

Answered
Displaying numbers in GUI
your_number=10 set(handles.textbox1,'string',num2str(your_number))

13 years ago | 2

Answered
problem in converting double Array into character?
You should use cell array clear a(1)=49 a(2)=49 a(3)=152 a(4)=50 z{1}=num2str(a(1)); z{2}=num2str(a(2)); z{3}=int2st...

13 years ago | 1

Answered
What is the need for having the 'length' code in this script?
|N = length(n)| is not doing anything, just a waste of time

13 years ago | 0

Answered
how to hold legend
Look at this Example t=0:0.1:10; y1=sin(t); y2=cos(t); % ------Plot the first data---------- plot(t,y1); h=legend('wor...

13 years ago | 3

| accepted

Answered
Plotting all numbers from a set
There is an infinity of floating numbers in your interval. You can't plot all the numbers

13 years ago | 0

Load more