Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a matrix and a row vector produced by the std function:
X = [1 2 3; 4 5 6];
sigma = std(X);
Now I would like a vectorized solution that updates each value in X by dividing the value with the correct value in sigma. It would look something like this:
X(1,1)/sigma(1)
X(1,2)/sigma(2)
X(1,3)/sigma(3)
X(2,1)/sigma(1)
X(2,2)/sigma(2)
X(2,3)/sigma(3)
Just expand sigma and use elementwise division
Y = X ./ repmat (sigma, rows (X), 1)
Y =
0.47140 0.94281 1.41421
1.88562 2.35702 2.82843
A more elegant solution would be to use bsxfun, which is faster and cleaner than repmat.
The topic has been extensively covered here.
> bsxfun(#rdivide,X,sigma)
ans =
0.47140 0.94281 1.41421
1.88562 2.35702 2.82843
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am working with dmx that gives me values from 0 to 255 and the motor moves from -270 to 270.
I need the calculation that this program uses.
(i am using lua)
Img 1
Img 2
Img 3
Not an expert of your technology, but from your images, it seems that you have a linear function from [0, 255] -> [-270, 270]
So I guess the value 129 gives you a motor value of 2,1 approximately.
I let you check this and process the other values accordingly. If needed, draw a function graph to see the shape of your function.
Luke100000 gave the following formulas:
1- dmx / 255 * 540 - 270 = motor
2- motor (x) = 9/138176 x ^ 2 + 290313/138176 x - 270
the first if I get a value of 255 gives me 270
the second if I get a value of 255 it gives me 265.7724569868085
so the first would be the most accurate.
Thanks for the help.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
Improve this question
I create the points using this function right here.
local GR = (math.sqrt(5) + 1) / 2
local GA = (2 - GR) * (2 * math.pi)
local function fibonacciSpiralSphere(num_points)
local vectors = {}
for i = 1, num_points do
local lat = math.asin(-1 + 2 * i / (num_points + 1))
local lon = GA * i
local x = math.cos(lon) * math.cos(lat)
local y = math.sin(lon) * math.cos(lat)
local z = math.sin(lat)
table.insert(vectors, Vector3.new(x, y, z))
end
return vectors
end
How the points turn out.
I just can't figure out how to make a sphere mesh out of them.
Things like that are usually solved using Delaunay Triangulation.
As you have some knowledge about your point set you can simply find each points nearest neighbours. So run through the point set and check the distances.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am entirely new to the realm of graphics and I am finding it particularly hard with WebGL. I would like to know how to "plot" x,y,z given their screen coordinates...
Suppose say
x = 50, y = 0, z = 0,,
x = 50, y = 0, z = 600,,
....,,
x = 4900, y = -52, z = 0,,...
and there are certain indices like 2, 0, 0, 2, 0, 1, 4,....
and then, there is something called 4x4 transformation matrix like
-0.6,-0.6,0,0,,
0.6,-0.6,0,0,,
0,0,1,0,,
1590,980,0,1...`
What am I supposed to do with all these - if I need to get the relevant shape...
Is it possible to explain with some sample data ?
There are a lot of details, and unfortunately you did not share what you know and what you don't.
Have a look at some good introductory tutorials:
http://games.greggman.com/game/webgl-fundamentals/
http://learningwebgl.com/blog/?page_id=1217
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How can we see the z value , which is the reconstruction of x (dataset )
Please see the link : http://deeplearning.net/tutorial/dA.html
The function "get_reconstructed_input" will return a Theano variable that represent z from the hidden representation. Check the function "get_cost_updates" It use it to train the model.
tilde_x = self.get_corrupted_input(self.x, corruption_level)
y = self.get_hidden_values( tilde_x)
z = self.get_reconstructed_input(y)
If you don't want to train the model, you can do this:
y = self.get_hidden_values(self.x)
z = self.get_reconstructed_input(y)
To make an executable function that compute this:
f = theano.function([x], z)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I know this might be too easy to be a question... but I can't get why sin(0.2*x + pi) is aperiodic?..
I tried to plot this in matlab and that's what I got:
That should be periodic right? Instead in "Schaum's Outline of Digital Signal Processing" book it says it's aperiodic
The function f(x) = sin(pi + 0.2*x) is periodic.
The sequence sin(pi + 0.2*n) where n=0, 1, ... is not periodic.
sin(0.2*x + pi), x in R (i.e. x - real) is periodic, as we could find such x0 that sin(0.2*x + pi) = sin(0.2*(x + x0) + pi)
sin(0.2*x + pi), x in N_0 (i.e. x - natural and zero) is not periodic. You've provided exactly the proof of that fact in page screenshot.