Answered
changine if-elseif to a switch-case structure
Dear Mike, You can convert if-else code to switch case structure as follows: InputValue = input('Input value: '); val = ...

12 years ago | 0

| accepted

Answered
How do I apply an if statement to every row of a matrix of varying number of rows?
Dear Shannon, you can put the if-else statements in a loop as follows: A=load('Dynamics.txt'); m=A(:,1); c=A(:,2); ...

12 years ago | 1

Answered
How can I make a vector from the elements in the same position across many matrices?
Dear Patrick, you can do it as follows: NumberOfMatrices = 736; A = randi(100, 72, 144, NumberOfMatrices); % Your 736 ma...

12 years ago | 0

| accepted

Answered
How to Stretching and shrinking a graph
Beside the comment you can do something like this: scaling_factor = 2; % define the scaling factor and graph will scale acc...

12 years ago | 0

Answered
how to compare two cells and fetch the values ?
Dear Sandy, maybe you can try something like this: x= ['A','B','C','D','E','F']; y= ['B','E','F']; z = reshape(inters...

12 years ago | 0

Answered
how to do watershed segmentation?
Dear Sheno, maybe following links are helpful for you: <http://www.mathworks.com/help/images/ref/watershed.html> <http://w...

12 years ago | 0

Answered
The question is here http://i.imgur.com/EkSTC0x.png?1
Dear Leonardo, here is the code for this problem: x_deg = input('Input angle in degrees: '); x = degtorad(x_deg); sum...

12 years ago | 1

| accepted

Answered
What does this code say? (Linear Algebra related) (Poisson)
Dear Guile, I placed references for all the things which maybe confusing for you. You can try to access those references to find...

12 years ago | 0

Answered
How to extract data from a cell in a specific way ?
Dear Stamatis, here is code for converting cell array into a matrix: for i = 1:12 data{i} = rand(1, 69); % create ce...

12 years ago | 1

| accepted

Answered
How to ignore new values?
Dear Tristan, you can do it as follows: p1 = 5; % initialize p1 a = p1; % store p1 value in new variable to use later ...

12 years ago | 0

| accepted

Answered
how can I plot this equation ?
Dear Ahmed, here is the code: Lgo = 1; % constant value for Lgo Lg2 = 1; % constant value for Lg2 theta = -pi:0.01:pi...

12 years ago | 0

Answered
Writing a script file for cost of a telephone call according to the following price schedule:
Dear Andrew, here is the code for your question: calltime = input('Enter call time(day, evening, night): ', 's'); calldu...

12 years ago | 0

| accepted

Answered
Compute Fourier Series Coefficients
Dear Claire, see the following link: <http://www.mathworks.de/matlabcentral/answers/90990-how-to-calculate-fourier-coefficients-...

12 years ago | 0

Answered
Formatting code to display multiple results.
Dear David, you can output iteration number and iteration values as follows: function [xn, iterations] = Newton (f, df, xi,...

12 years ago | 1

| accepted

Answered
how can i subplot 4 separate graphs for machine's velocity
Here is one alternate: V = 70; machine = [100 150 200 250]; t=0:0.5:10; for i = 1:numel(machine) road = V*e...

12 years ago | 1

| accepted

Answered
if A=1:0.1:10 and B=1:4,T=exp(A/B) , is there anyway to plot a graph of T against A?
Dear Austin, you can do it as follows: A = 1:0.1:10; B = linspace(1, 4, numel(A)) T=exp(A./B); plot(A, T), xl...

12 years ago | 0

Answered
Center of mass - Going nuts!
Dear Rasmus, I run your code and got these two values: Xko = 2.000428632661809 Yko = 3.357265323617660 Ar...

12 years ago | 0

Answered
calculate the annual discharge over several years
Dear Maria, here is the code for required functionality: ID = fopen('filename.txt'); data = textscan(ID, '%f%f%f%f'); ...

12 years ago | 0

Answered
Plotting two 3D points from a textscan output
Dear Tom, you can do it as follows: ID = fopen('filename.txt', 'r'); data = textscan(ID, '%s'); fclose(ID); data =...

12 years ago | 0

| accepted

Answered
Bar Plot of 2-D Array - How to label each individual bar with the value on top?
Dear Robert, replace first two lines of your code as follows and you will get your desired bar plot: x=[1:15]'; y=round...

12 years ago | 0

Answered
How to customize excel?
Dear Tommaso, maybe it is helpful for you: <http://www.mathworks.de/matlabcentral/answers/37284> Good luck!

12 years ago | 0

Answered
How can I draw a 3D Free Energy Diagram from a text file which has 3 columns?
Dear Ankita, you can plot 3 columns of equal length as follows: ID = fopen('filename.txt'); data = textscan(ID, '%f%f%f'...

12 years ago | 0

| accepted

Answered
How to multiply Multidimensional Arrays with a column vector
Dear Tristan, here is the code which performs the task: A = cat(3, [2 8; 0 5], [1 3; 7 9]); B=[1 2]'; for i = 1:lengt...

12 years ago | 0

Answered
Multiplying 2 matrices, using a for loop and storing results in a table.
Dear Andres, you can do it as follows using for loop: D = [cos(pi/18) -sin(pi/18); sin(pi/18) cos(pi/18)]; X = [0.80;0];...

12 years ago | 0

Answered
Read data from file and print information for whom has the required criteria?
Dear Nora, here is the code which reads the file and then shows information for people having blood group 'AB': ID = fopen(...

12 years ago | 0

| accepted

Answered
new to Matlab --- how do I enter a matrix summation to find the time response of vibration
Dear Todd, one way to do is as follows: syms t_sym u = [1, 0; 0, 0]; v = [0, 0; 0, 0]; Xi = [1, 0.78; 0.78, -1]; ...

12 years ago | 0

Answered
Changing names within a data
Dear Nora, here is the code which performs your desired task: ID = fopen('filename.txt'); a = textscan(ID, '%s%f'); f...

12 years ago | 0

| accepted

Answered
plotyy two variables one with two series
Dear Abdulaziz, yes you can plot it. The following is an illustration of it: temparature = 1:100; u = rand(1, 100); v...

12 years ago | 0

| accepted

Answered
A very basic question about nested for loops
Dear Negar, re-write the last line as follows: sigma_est{i} = cov(F); Then sigma_est will contain 9 matrices of 2x2 size...

12 years ago | 0

| accepted

Answered
Madhava approximation of pi
Dear Kaylynn, here is the function which approximates value of pi using Madahava Sangamagrama equation: function [ output_a...

12 years ago | 0

| accepted

Load more