All MATL examples up to now end with a D function (display). I guess MATL should automatically print at the end (either the top or the whole stack), as CJam does. That would save 1 byte
That's the point. I initially decided not to do implicit printing to prevent garbage from showing. But looking at all examples up to now, all print the top element at the end, and in all but two that's the only element left. In those two examples there's only one unwanted element (the ont not at the top), which could be removed in two characters:
w % swap elements in stack
x % delete
@beaker ^^
Of course the D and E display functions would be kept, so you can print before the end of the program
Matlab 171 bytes
The input should be a 2d matrix, so you would call it like c([1,1,1,1;0,0,0,0;0,0,0,0;1,1,1,1]) (semicolons start a new row). This function just bruteforces all possible moves, so we get a runtime of O(2^(n^2)).
How it is done
This is done by choosing all possible ways to fil...
A photography is taken out of a side window of a car moving at a constant velocity of 80 km/hour. Why is it not possible to use an inverse or Wiener filter in general to restore the blurring in this image ? Describe it briefly.
No, for your information that's not how this site works. My 50K reputation above you mere 2 begs to differ. This site is about answer programming problems when you have shown effort in trying to solve your problem. We are NOT a do-your-homework service nor is this doyourhomeworkoverflow.com. Please read this page on how to write a proper question: stackoverflow.com/help/how-to-ask. You can at LEAST phrase your question such that it doesn't sound like a direct copy and paste from your homework assignment. At this stage, NO ONE is going to help you. Guaranteed. — rayryeng30 secs ago
But the true answer is that the Wiener filter is used for reconstructing images when the camera is subject to motion or when the lens itself is subject to distortion when capturing images, not the objects in the image.
I would have written an answer if the OP made a bit of effort asking an actual question and not copying and pasting from a homework assignment.
@rayryeng @excaza @beaker @Dev-iL I'd like your input, I might have found a bug in R2012b and str2func (I know, cousin of eval)
Compare: f = @(x) 4*x funtmp1 = str2func('@(x)[sin(x)]'); funtmp2 = str2func('@(x)[f(x)]'); funtmp1(1) %OK funtmp2(1) %throws error, even though f is in the workspace
> If you include workspace variables in your string, str2func creates the function handle, but MATLAB throws an error when you invoke the function handle.
I could turn {@(x,y,z) f1(x,y,z), @(x) f2(x), @(y,z) f3(y,z)} into @(x,y,z) [f1(x,y,z); f2(x); f3(y,z)], which could have been invoked as an anon function
I would've put effort into that question if the OP gave a concrete example of the intended output (like "in the case of a Hermite basis, f would be ..."). I could've asked, but I chose to be lazy and cantankerous.