Answered

starting MATLAB and not experienced in programming

Also check out the MathWorks' <http://www.mathworks.com/academia/student_center/tutorials/ free MATLAB tutorial>.

starting MATLAB and not experienced in programming

Also check out the MathWorks' <http://www.mathworks.com/academia/student_center/tutorials/ free MATLAB tutorial>.

mer än 9 år ago | 0

Answered

Fixed-size text that zooms/scales with a plot?

Here's a cute little function that does what you're looking for. function textWithZoomEffect % plot some original da...

Fixed-size text that zooms/scales with a plot?

Here's a cute little function that does what you're looking for. function textWithZoomEffect % plot some original da...

mer än 9 år ago | 1

| accepted

Answered

Dumb mistakes we make with MATLAB.

>> close al Error using close (line 111) Specified window does not exist. Dammit!

Dumb mistakes we make with MATLAB.

>> close al Error using close (line 111) Specified window does not exist. Dammit!

mer än 9 år ago | 1

Answered

solving linear equations using matrices in MATLAB

If you're trying to solve for U in the expression K*U = F, don't use linprog or solve... use mldivide (the backslash operator) ...

solving linear equations using matrices in MATLAB

If you're trying to solve for U in the expression K*U = F, don't use linprog or solve... use mldivide (the backslash operator) ...

mer än 9 år ago | 1

Answered

what does eigenvalues expres in the covariance matrix?

Long story short: The eigenvalues of the covariance matrix encode the variability of the data in an orthogonal basis that captur...

what does eigenvalues expres in the covariance matrix?

Long story short: The eigenvalues of the covariance matrix encode the variability of the data in an orthogonal basis that captur...

mer än 9 år ago | 3

| accepted

Answered

Small "toy rocket" - Simulation

You're super close... Just make one change to the height function so it looks like this one below: function [h] = heig...

Small "toy rocket" - Simulation

You're super close... Just make one change to the height function so it looks like this one below: function [h] = heig...

mer än 9 år ago | 1

| accepted

Answered

Contour Plot from Coordinates

I will assume you have three vectors: x, y, and z (where z represents pressure). For example x = rand(1,100); y = rand(...

Contour Plot from Coordinates

I will assume you have three vectors: x, y, and z (where z represents pressure). For example x = rand(1,100); y = rand(...

mer än 9 år ago | 1

| accepted

Answered

Anonymous functions and integration

Try r = integral (@(x)f(x)'*f(x), 0, 1, 'ArrayValued', true);

Anonymous functions and integration

Try r = integral (@(x)f(x)'*f(x), 0, 1, 'ArrayValued', true);

mer än 9 år ago | 1

| accepted

Answered

Create orthonormal basis from a given vector

So, given vector v = [a;b;c]; in R^3, it follows that any point (x,y,z) that satisifies a*x + b*y + c*z = 0 (i.e. a poin...

Create orthonormal basis from a given vector

So, given vector v = [a;b;c]; in R^3, it follows that any point (x,y,z) that satisifies a*x + b*y + c*z = 0 (i.e. a poin...

mer än 9 år ago | 7

Answered

How can I return the last value of a vector?

Try X(end) In general, if X is a m-by-n-by-p-by... You can use X(end,end,end,...) to access element in last r...

How can I return the last value of a vector?

Try X(end) In general, if X is a m-by-n-by-p-by... You can use X(end,end,end,...) to access element in last r...

mer än 9 år ago | 0

| accepted

Answered

How to color RED to the lower portion of the curve

Replace the plot(x,y) command with area(x,y,'FaceColor',[1 0 0])

How to color RED to the lower portion of the curve

Replace the plot(x,y) command with area(x,y,'FaceColor',[1 0 0])

mer än 9 år ago | 1

| accepted

Answered

Fincon Warning: undesired gradient requirement

The trust-region-reflective algorithm is the default option for fmincon. You can specify the solver by adding the name-value ...

Fincon Warning: undesired gradient requirement

The trust-region-reflective algorithm is the default option for fmincon. You can specify the solver by adding the name-value ...

mer än 9 år ago | 0

| accepted

Answered

Permute problem - unexpected Matlab operator

The first command is invalid. The second command will work - and is what you want - once you remove the extra > at the beginn...

Permute problem - unexpected Matlab operator

The first command is invalid. The second command will work - and is what you want - once you remove the extra > at the beginn...

mer än 9 år ago | 1

| accepted

Answered

How to get the positive root of the cubic a*x^3+3*b*x^2+3*c*x+d=0

You can try b = .1:.1:2; a = 1; c = b+2; d = -3; posR = zeros(1,length(b)); for i = 1:length(b) r...

How to get the positive root of the cubic a*x^3+3*b*x^2+3*c*x+d=0

You can try b = .1:.1:2; a = 1; c = b+2; d = -3; posR = zeros(1,length(b)); for i = 1:length(b) r...

mer än 9 år ago | 0

| accepted

Answered

I want to show intersection of these two spheres. How should I do it?

The spheres you describe have equations 1.) x^2 + y^2 + z^2 = 1 2.) (x-0.25)^2 + (y+1/5)^2 + (z-0.1)^2 = 1 Since equati...

I want to show intersection of these two spheres. How should I do it?

The spheres you describe have equations 1.) x^2 + y^2 + z^2 = 1 2.) (x-0.25)^2 + (y+1/5)^2 + (z-0.1)^2 = 1 Since equati...

mer än 9 år ago | 0

| accepted

Answered

how to get SNR for 2 images

You'll get different answers, depending on who you're talking to. I would suggest using snr = 20*log(norm(X0,'fro')/no...

how to get SNR for 2 images

You'll get different answers, depending on who you're talking to. I would suggest using snr = 20*log(norm(X0,'fro')/no...

mer än 9 år ago | 1

Answered

How can I construct a dataset array from data on an excel worksheet with an unknown number of rows

Just try d = dataset('XLSFile',yourFileName,'Sheet','mysheet')

How can I construct a dataset array from data on an excel worksheet with an unknown number of rows

Just try d = dataset('XLSFile',yourFileName,'Sheet','mysheet')

mer än 9 år ago | 0

Answered

Rotate co ordinates by a rotation matrix.

Is that 5 radians or 5 degrees you wish to rotate the points. If it's 5 degrees, I think you mean to have rot = [cosd(5),s...

Rotate co ordinates by a rotation matrix.

Is that 5 radians or 5 degrees you wish to rotate the points. If it's 5 degrees, I think you mean to have rot = [cosd(5),s...

mer än 9 år ago | 0

| accepted

Answered

using a 'for' loop to create a vector

You are parametrizing your for-loop using a vector of nonintegers, then trying to index into the variable x. I would instead pa...

using a 'for' loop to create a vector

You are parametrizing your for-loop using a vector of nonintegers, then trying to index into the variable x. I would instead pa...

mer än 9 år ago | 2

| accepted

Answered

"Not enough input arguments" error when integrating a function

You need to use a function handle... try integral(@fun,0,1)

"Not enough input arguments" error when integrating a function

You need to use a function handle... try integral(@fun,0,1)

mer än 9 år ago | 2

Answered

how to combine cells into a matrix

Given your out varialble, try out = fliplr([out{:}]) If you want to flip each row vector, then concatentate use out...

how to combine cells into a matrix

Given your out varialble, try out = fliplr([out{:}]) If you want to flip each row vector, then concatentate use out...

mer än 9 år ago | 1

| accepted

Answered

can anybody please tell me the use of 'val' function in this program.., it is not a valid function,yet the program can't be executed without using this,or by changing the function name.

The lines [fname path]=uigetfile('*.mat'); fname=strcat(path,fname); load(fname ); will load a .mat file into the sco...

can anybody please tell me the use of 'val' function in this program.., it is not a valid function,yet the program can't be executed without using this,or by changing the function name.

The lines [fname path]=uigetfile('*.mat'); fname=strcat(path,fname); load(fname ); will load a .mat file into the sco...

mer än 9 år ago | 0

| accepted

Answered

Advice on a few bottlenecks in my code

If you don't need the actual indices, you can omit the find command to save time. In particular, notice that the following code...

Advice on a few bottlenecks in my code

If you don't need the actual indices, you can omit the find command to save time. In particular, notice that the following code...

nästan 10 år ago | 0

Answered

Saving variables and figures uniquely when processing a sequence of files

try hgsave(['SummaryPlot',num2str(ii)]); notice the square brackets in order to concatenate 'SummaryPlot' and the outpu...

Saving variables and figures uniquely when processing a sequence of files

try hgsave(['SummaryPlot',num2str(ii)]); notice the square brackets in order to concatenate 'SummaryPlot' and the outpu...

nästan 10 år ago | 0

| accepted

Answered

Help with timing a pushbutton being pushed twice

Computing the time elapsed between two date vectors is nontrivial, I bet you're getting some weird behavior here. Try using the ...

Help with timing a pushbutton being pushed twice

Computing the time elapsed between two date vectors is nontrivial, I bet you're getting some weird behavior here. Try using the ...

nästan 10 år ago | 0

Answered

How can I resolve this problem using vertcat on matrices for daily files to create a single matrix for the whole year?

So, I'm guessing that newData2 is not a structure, in particular it is a double? Perhaps try fixing your code by replacing th...

How can I resolve this problem using vertcat on matrices for daily files to create a single matrix for the whole year?

So, I'm guessing that newData2 is not a structure, in particular it is a double? Perhaps try fixing your code by replacing th...

nästan 10 år ago | 0

Answered

how to create a matrix with variables in it?

The best answer to your question will likely depend on what you want to do with A. Sometimes, I find the following commands use...

how to create a matrix with variables in it?

The best answer to your question will likely depend on what you want to do with A. Sometimes, I find the following commands use...

nästan 10 år ago | 4

Answered

How to find sign of a function

If you can evaluate your function with a command like y = yourFcn(x); then you can determine the sign with a logical var...

How to find sign of a function

If you can evaluate your function with a command like y = yourFcn(x); then you can determine the sign with a logical var...

nästan 10 år ago | 0

Answered

How can i simultaneously reference in cells

This is fun... you can try C{1}=[1 2;3 4;5 6] C{2}=[7 8;9 10;11 12] g = @(j)[C{1}(j,:);C{2}(j,:)]'; % function handle...

How can i simultaneously reference in cells

This is fun... you can try C{1}=[1 2;3 4;5 6] C{2}=[7 8;9 10;11 12] g = @(j)[C{1}(j,:);C{2}(j,:)]'; % function handle...

nästan 10 år ago | 0

| accepted

Answered

How to make an inset of matlab figure inside the figure.

Maybe try something like x1 = linspace(0,1); x2 = linspace(3/4,1); y1 = sin(2*pi*x1); y2 = sin(2*pi*x2); figure(1) % p...

How to make an inset of matlab figure inside the figure.

Maybe try something like x1 = linspace(0,1); x2 = linspace(3/4,1); y1 = sin(2*pi*x1); y2 = sin(2*pi*x2); figure(1) % p...

nästan 10 år ago | 33