Answered
Random integer numbers using random function
Something like: function ri = rnum() ri = num2str(randi([1,9],1,9)); ri = ri(~isspace(ri)); end

12 years ago | 1

| accepted

Answered
Plotting exponential curves with random numbers.
This will do: N = 100; b = 0.150 + (0.424-0.150)*rand(N,1); c = 0.252 + (0.372-0.252)*rand(N,1); x = 0:0.1:1...

12 years ago | 0

Answered
How do i write data to a specfic path without using cd(path)?
Hugo, try dicomwrite(X, strcat(uigetdir,'myfilename.dcm')); where |X| represents the image to be written. Of course, you...

12 years ago | 0

| accepted

Answered
how to save/write images using for loop?
Azizullah, the code snippet below shows you how to save an (or several) images using a loop. N = 4; A = imread('my_img.p...

12 years ago | 5

Answered
the stiff IVP y'(t) = -30*y+30*t^2+2*t; y(0)=1, & exact solution is y(t)=e^-30*x +x^2. using fourth order Runge-kutta method. solve by hand and by matlab
Jamila, please *format your question(s)* for better readability. There are a couple of issues with your code. Check out the f...

12 years ago | 0

Answered
Is there a cheap daq kit for matlab?
Keith, how about <http://www.mathworks.com/hardware-support/digilent-analog-discovery.html Digilent's Analog Discovery>? It is r...

12 years ago | 0

Answered
Summation loop (sigma notation) help
In your code sum_a = 0.5; for ii = 1:length(a) sum_a = sum_a + a(ii).^n; end you initially set |sum_a = 0.5|....

12 years ago | 1

Answered
Asked to plot using vectors of unequal sizes
B.M., simply compute |y| in a |for|-loop and plot the results in the same figure using |hold all|. You also might want to includ...

12 years ago | 0

| accepted

Answered
I am new to mat lab, where do I start?
Isaac, I recommend checking out MathWorks <http://www.mathworks.com/academia/?s_tid=gn_acad Academia> web site, and, in particul...

12 years ago | 1

| accepted

Answered
License error 103
Al, please see this <http://www.mathworks.com/matlabcentral/answers/91874 answer>.

12 years ago | 1

Answered
Undefined function or variable
UTS, with those values for |A| and |B| you never enter the loop and therefore no values are assigned to |x|, which is why it is ...

12 years ago | 0

| accepted

Answered
Cannot get factorial loop to work! Do not know command...
Use a = [1:100]; b = 2; y = 0; for ii = 1:length(a) y = y + a(ii)^b; end display(y); Your sum, |...

12 years ago | 2

Answered
Do while loop in Matlab
There is no 1-to-1 correspondence to the C++ do while loop in MATLAB. Your best option is to use a while loop. The difference is...

12 years ago | 27

| accepted

Answered
Solving differential equations using ODE15s
Agreed. Check out the code below. You will have to adapt it since I could not quite read some of the equations. function m...

12 years ago | 0

Answered
create a new variable whos name is conditional
Use the <http://www.mathworks.com/help/matlab/ref/genvarname.html |genvarname|> command. mv = genvarname('my_varname'); ...

12 years ago | 0

| accepted

Answered
How to choose a column where the min of the first row is
Use G = H(:,a==min(a)) or, the more general approach avoiding reference to |a|, G = H(:,H(1,:)==min(H(1,:)))

12 years ago | 0

| accepted

Answered
How to have number as marker symbol in plot
Use <http://www.mathworks.com/help/matlab/ref/text.html |text|> objects to add markers, e.g.: x = 0:1:10; y = sin(x); ...

12 years ago | 10

Answered
is it possible to do a numerical integration without using a for loop?
One option of avoiding to write your own loop is using one of MATLAB's integrators, e.g., <http://www.mathworks.com/help/matlab/...

12 years ago | 0

Answered
How to sort two columns of a data
Abin, use <http://www.mathworks.com/help/matlab/ref/sortrows.html |sortrows|> : A = rand(4,2) B = sortrows(A) Once sort...

12 years ago | 1

| accepted

Answered
Help Print Command Error
OK. Use sprintf('%5.2f: %5.2f', t, y) or something like that. With the |%5.2f| you can specify the number format: total ...

12 years ago | 0

Answered
Store permanently data taken from an edit text box of GUI
Absolutely. E.g., save your data as a |.mat| file. Check out this <http://www.mathworks.com/matlabcentral/answers/99928#answer_1...

12 years ago | 0

Answered
Customize a fitting curve (semi-ellipse)
Check out this <http://www.mathworks.com/matlabcentral/answers/98522 answer>. And use, e.g., t = (0:pi/10:2*pi)'; x ...

12 years ago | 0

Answered
Help with linear fit
Here is one way: x = 0:0.05:1; % define data y = sin(x).^2; x1 = x(10); ...

12 years ago | 0

| accepted

Answered
How to find 3d vector if I know the other vector and the angle between them
In general, not at all. Since your vector |dv2| could lie anywhere on a cone that is defined by |dv1| (as the symmetry axis) and...

12 years ago | 0

| accepted

Answered
plot figure from a vector saved from a for cycle
Yep. Use plot(Re_vec, Peak_vec) to plot all data. The way you have it set up right now, you only plot the |i| th data po...

12 years ago | 0

| accepted

Answered
I am getting the below mentioned problem when I am simulating "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler."
Shailesh, as the msg implies you need to tell MATLAB which compiler should be used. Which, of course, means that there needs to ...

12 years ago | 0

| accepted

Answered
Log axis on plots of different types
As an example of using subplots (I believe that's what you are asking for): x = linspace(1,10,200); y = x.^2; figure ...

12 years ago | 0

Answered
how to get new coordinatesof the point[2,1,3],if a vector with endpoint[2,1,3] is rotated 30 around the Z-axis followed by 60 around the x-axis.all rotations are counter clockwise.
Nikhil, if you want to rotate vectors (rather than the coordinate system) use the <http://www.mathworks.com/help/phased/ref/rotz...

12 years ago | 0

Answered
How to display each individual word of a string
Use my_str = strsplit('This is a test'); for ii = 1:length(my_str) display(my_str{ii}); end

12 years ago | 3

Answered
Need help graphing a surface!
MATLAB is your tool. Try [x,y] = meshgrid(0:.1:10); z = x - y; mesh(z); box |mesh| is only one of several optio...

12 years ago | 0

Load more