Answered
I have an array of angles and I need to identify periods where this array is above or below certain thresholds
Use array_ind = find(array<15 | (array>=165 & array<=195) | array>345)

12 years ago | 0

Answered
writing two integer together into edit text.
Use something like c = sprintf('%d%d',a,b); set(handles.edit_text, 'String', c); where the UI control is called |handl...

12 years ago | 0

| accepted

Answered
How to convert matlab code in cpp
ECG, you need the <http://www.mathworks.de/products/matlab-coder/ MATLAB Coder> to generate C/C++ code.

12 years ago | 0

Answered
How to draw a 3D plot of a function in form y=f(X) and X is an array [X(1),X(2)] ?
Sadeg, use something like [X,Y] = meshgrid(0:0.1:1); Z = sin(X).*cos(3*Y).^2; surf(X,Y,Z)

12 years ago | 0

| accepted

Answered
Function to extract certain elements from a matrix
Ciuban, use B = A(:,A(1,:)==1)

12 years ago | 2

| accepted

Answered
how to execute loop again and again without double executing the program?
Kanu, something like (not optimized) ... exitFLAG = true; while exitFLAG [x,y] = ginput(2) if ~strcmp(get(gcf,...

12 years ago | 0

| accepted

Answered
negative zero as eigenvalue
Suma, it's not really zero. Set the display format to long fixed decimal: format long [v, d] = eig(a) v = 0.38133397...

12 years ago | 0

| accepted

Answered
how to calculate f(x) = a*x^b+c
Rupraj, use f = a*x^b + c This should result in f = 2.009395380889448e+02

12 years ago | 0

| accepted

Answered
problem with plotting differential equation
Goran, use something like function myODE() tspan = 0:0.1:10; IC = 1; [t,y] = ode45(@ODEfun,tspan,IC); plot(...

12 years ago | 0

Answered
How to find an approximate solution to a perturbed differential equation in Matlab?
Connie, the unperturbed differential equation is simply x'' - x = 0 % or should it rather say x'' + x = 0? which you ca...

12 years ago | 0

Answered
Simulink support package for Arduino - Combining with cusom code?
Alex, you can implement MATLAB code (is this what you are referring to as custom code?) in Simulink, e.g., via the MATLAB functi...

12 years ago | 0

Answered
How to compute the sum of the squares of all integers from 1 to 50 using for-loop?
OK, use mysum = 0; for ii = 50:-1:1 mysum = mysum + ii*((51-ii) + ii)^2; end Of course you could simplify, since...

12 years ago | 1

Answered
How can extract only real values of a matrix
Tinkul, use real(A)

12 years ago | 0

| accepted

Answered
Add arrows to a graph
JMS, if you are talking about the vector field, use <http://www.mathworks.de/de/help/matlab/ref/quiver.html |quiver|>. For label...

12 years ago | 0

Answered
Calculate differences between all values in vector
Swisslog, you could use pdist([2 3 1 4]',@(x,y) x-y)

12 years ago | 1

Answered
How can I change the colour background in a region using plot?
Diego, you could plot a properly sized <http://www.mathworks.de/de/help/matlab/ref/rectangle.html |rectangle|> on top of which (...

12 years ago | 0

Answered
interfacing b/w motor and wheel model
Shahzor, I believe what you are looking for are the Simulink-PS and PS-Simulink Converter blocks. They are located in the Simsca...

12 years ago | 0

Answered
how to change displayed format of numbers?
Dominika, use A = vpa(solve(...)) or A = vpasolve(...)

12 years ago | 0

| accepted

Answered
decimal matrix to binary matrix
Kiran, try B = arrayfun(@(ii,jj) {dec2bin(A(ii,jj))},repmat((1:size(A,1))',1,size(A,2)),repmat((1:size(A,2)),size(A,1),1));

12 years ago | 0

Answered
How to create a continuos surface in 3D
How about doing it from scratch? x = -2:0.1:2; y = -2:0.1:2; [X,Y] = meshgrid(x,y); Z = X.*exp(-(X - Y.^2).^2 - Y.^2);...

12 years ago | 0

| accepted

Answered
Solving Linear System of Equations.
Salaheddin, the rank of |a| is 2, one solution (by inspection) is, e.g. 15/14*a(:,1) + a(:,2) - 2.5*a(:,3) You could also...

12 years ago | 1

Answered
Numerically Solving a System of Differential Equations in Parallel?
Kevin, check out this <http://www.mathworks.de/matlabcentral/answers/116782-how-to-plot-phase-plane-in-matlab#answer_125728 answ...

12 years ago | 2

Answered
Delaying the input of a System
Sai, use u = sin(2*pi*fm*(t-t(6)))'; u(1:5) = 0;

12 years ago | 0

| accepted

Answered
multiple inputs for a function
Giuseppe, you could use function ispal = palindrome(forward_string) for ii=1:numel(forward_string) ispal{ii} = strcmp...

12 years ago | 0

| accepted

Answered
increment values which are larger than three
Sososasa, use B = A + (A>3)

12 years ago | 2

| accepted

Answered
How to make up the diagonal summation without for loop and with the fastest way!
Hyunchul, something like fA = fliplr(A); B = fliplr(arrayfun(@(i) sum(diag(fA,i)),-length(A(:,1))+1:length(A(1,:))-1));

12 years ago | 0

Answered
How do you multiply one single constant value with a 1D array/matrix containing 25 values in Simulink?
James, simply use a Gain block (Commonly Used Blocks) and choose Element-wise multiplication (double-click to open the block). T...

12 years ago | 0

| accepted

Answered
help with plotting smooth curve
Arnav, use global Z_hit theta1 = 1:2:20; data = zeros(1,numel(theta1)); for ii=1:numel(theta1) Z_hit = 3*((0...

12 years ago | 0

| accepted

Answered
Adding all the elements of a 1-d matrix/array in Simulink
James, as you suggest, you could use a MATLAB function block (used to be called Embedded MATLAB function) with the following cod...

12 years ago | 0

| accepted

Answered
How I can overlap two functions in Simulink?
Azz, what about simply adding the two signals? Use two Sine Wave source blocks and a Sum block.

12 years ago | 0

Load more