Answered
How do i get the arg(A(j)) and I A(j) I of an equation?
Jey, use |abs(A)| and |phase(A)| (or |angle(A)|): A = (1+2j)/((6j^4)+(8j^3)+(2j^2)+(7j)+2); abs(A) ans = 0.001609781...

12 years ago | 0

| accepted

Answered
Errors in passing a constant to a function in boundary value problem (bvp4c function)
Amit, replace this one command solution = bvp4c(@odefunction,@bcfunction,solinit); by options = []; solution = b...

12 years ago | 2

| accepted

Answered
Modelling behaviour of simple sound source
Will, use ut = F*i*om./(mt*(omt^2-om.^2) + i*gamt*om); Notice the dot in front of the forward slash.

12 years ago | 0

| accepted

Answered
Getting the scope to show sum of time series output with respect to time
James, you could use the <http://www.mathworks.com/help/dsp/ref/cumulativesum.html Cumulative Sum> block. It is included in the ...

12 years ago | 0

| accepted

Answered
plotting an array in different colors
Aditya, check out the sample code below: my_col = jet(20); t = 0:0.1:pi; a = 1:length(my_col(:,1)); y = a'*sin(t); h...

12 years ago | 0

| accepted

Answered
Is the command ''fzero'' based on Newton Raphson Method?
Karthik, the short answer is no. |fzero| is based on a combination of the bisection, secant, and inverse quadratic interpolation...

12 years ago | 1

Answered
How to plot scatter plot?
Alex, use v = [91.25,182.5,365]; A = [2.3,3.3,4.6]; scatter(A.^2,v)

12 years ago | 0

| accepted

Answered
v = [0:1:100] without numbers that can be divided by 5
Andries, use the |mod| command: v = 0:1:100; v(mod(v,5)==0) = []; % remove numbers divisible by 5

12 years ago | 0

| accepted

Answered
The circshift function not working.
Giuseppe, use xcor = [4 6 2]; xcor_p1 = [xcor xcor(1)]; xcor_p2 = [circshift(xcor_p1,[0 -1])]'

12 years ago | 1

| accepted

Answered
compare two vectors/compare coordinates
Ilya, use |isequal(a,b)|.

12 years ago | 1

| accepted

Answered
How do I find the area under this curve?
Blake, in your code you compute the velocity as a function of time. If you integrate the resulting velocity over time you'll get...

12 years ago | 0

Answered
Maximum Value of Individual Loops
Jeffrey, you can simply use max(Gamma) % row vector of max vals to get the maximum value of each column of |Gc|.

12 years ago | 0

Answered
How to set axis as -pi to pi ?
Leena, in the code you are converting the angels (x-axis) from rad to deg. Also it seems like the angular range is between 0 and...

12 years ago | 7

| accepted

Answered
How to get/save Curve Fitted Model data into Workspace with .mat file ?
Shara, you could simply use the |save| command: x = 0:0.1:pi; y = sin(x); ft = fittype('poly4'); [fitresult, gof] = ...

12 years ago | 1

| accepted

Answered
Plotting a line between two points
Scott, did you try it this way? xi = [O2_x(i) A_x(i) B_x(i) O4_x(i)]; yi = [O2_y(i) A_y(i) B_y(i) O4_y(i)]; plot(xi, yi)...

12 years ago | 0

Answered
Get a user to input corordinates to form a matrix.
Enter x- and y- coordinates, values separated by an empty space: prompt = {'x-coor:','y-coor:'}; name = 'Input coord...

12 years ago | 1

Answered
Calculating the distance between points using vectorization.
Giuseppe, would this do? points = [2 5; 6 9; 7 8; 9 10; 6 10]; b = points - circshift(points,-1,1); len = sqrt(sum(b.*...

12 years ago | 1

Answered
Y limits affect axis position?
Kurt, this should work: ylim(a1,[2.555+eps 4.0]);

12 years ago | 0

Answered
How to store the results from multiple "for loops" as a matrix
Oladunjoye, use someting like: P = zeros(njj,nkk); for jj = 1:njj ... P(jj,1:7) = [col1 col2]; % col1 is the 1-...

12 years ago | 0

| accepted

Answered
how to convert pitch period to frequency in Hert for a signal
Paul, typically |f = 1/T| (unless you are using a non-standard vocabulary), where |T| is the period in sec, |f| is the frequency...

12 years ago | 0

| accepted

Answered
How to calculate partial area-under-the-curve?
Mehdi, use |trapz| twice to subtract the area below the red marked one (between x-axis and data points |y = 0.3111, 0.1848| ) fr...

12 years ago | 1

| accepted

Answered
How to output both rho and pvalues of the Corr function when having an iterative loop
Fly, you could use a |cell| array: ... [r{repit} p{repit}] = corr(rep1(:,repit),rep2(:,repit)); ... The results from ...

12 years ago | 0

| accepted

Answered
how to call a function
Jitesh, I assume you are referring to the function |rle2|? If so, turn the preceding script into a function (I called it |mymain...

12 years ago | 0

| accepted

Answered
Help with a fit
Aurc89, does this help? a = 1; b = 1; c = 1; d = 1; e = 1; x = (0:0.1:2)'; y = a*exp(-x/b)+c*exp(-x/d)+e + 0.1*rand(leng...

12 years ago | 0

| accepted

Answered
Maximum Torque per Ampere Control Logic
Sreerag, have you looked into <http://www.mathworks.com/help/simulink/ug/about-lookup-table-blocks.html lookup tables>?

12 years ago | 0

| accepted

Answered
subplot,it can not show the line's name in plot broswer
Roger, are you referring to the |DisplayName|? subplot(2,1,1) h1 = plot(x,y1) set(h1,{'DisplayName'},{'xy1'}) subplot(...

12 years ago | 0

| accepted

Answered
copy from workspace to csv file without loss of significant figures
Dries, how about using |dlmwrite|? data = rand(3000,10); dlmwrite('test.csv',data,'precision',15);

12 years ago | 0

| accepted

Answered
Setting starting position of sphere.
ZK, do you mean setting the sphere origin? If yes, simply add the coordinates of the origin: [x,y,z] = sphere(80); surf(x+...

12 years ago | 0

| accepted

Answered
create new variable in dataset based on existing variable
Chetan, check out: myDset = num2cell([(1:24)', rand(24,1)]); % create some data for x = 1:24 if any(myDset{x,1} ==...

12 years ago | 1

| accepted

Answered
How would I open multiple figures from one script.
Correct, use |figure| just before each of the individual |plot| commands.

12 years ago | 12

Load more