I just need a block to model a saturation that gives me zero when the input is under a certain value and the input when it's above.
Change the Threshold in the Switch block to your desired value.
Related
I'm trying to build an autoencoder where some of the relevant input can be zero and non-relevant input will have a different unused value such as -999 or -np.inf.
I know how to use a Masking layer to mask timesteps where all input is equal to mask value or use Embedding layer with mask_zero=True to mask zero value inputs in timestep.
my question is if there's an embedding layer equivalent solution for non-zero values.
Thanks!
P.S. I realise I can replace all legitimate zero values with some other value and replace all non relevant values with zeros and use embedding layer with mask_zero=True as is but looking for a more straightforward solution
I am making a Simulink/Matlab control model, however, I am unsure on how to implement the following as a Simulink block:
saturation function
Where v(t) is the input of the saturation function, u_0 is a constant and u is the output.
I looked at the saturation and saturation dynamic blocks, however, I am unsure how to implement a dynamic output with a constant limit.
Thank you very much.
You can implement it using either of the blocks you mentioned (saturation and saturation dynamic).
Attached image shows how to use the Saturation Dynamic block to model your equations. Input signal v will be truncated to either +u0 or -u0 if its amplitude is larger than u0. In this implementation saturation limit u0 is constant as you requested. For a dynamic saturation limit you can drive up and lo block inputs with any other signal.
I have a question regarding the parameters in the edge function.
edge(img,'sobel',threshold);
edge(img,'prewitt',threshold) ;
edge(img,'roberts',threshold);
edge(img,'canny',thresh_canny,sigma);
How should the threshold for the first 3 types be chosen? Is there an aspect that can help choosing this threshold (like histogram for instance)? I am aware of the function graythresh but I want to set it manually. So far I know it's a value between 0-1, but I don't know how to interpret it.
Same thing for Canny. I`m trying to input an array for thresh_canny = [low_limit, high_limit]. but don't know how to look at these values. How does the sigma value influence the image?
It really depends on the type of edge you want to see in the output. If you want to see really powerful edges, use a smaller interval in the higher end of threshold (say 0.9-1) and this is relative to highest gradient magnitude of the image.
As far as the sigma is concerned, it is used in filtering the input image before passing to edge. This is to reduce noise in the input image.
When we use following Matlab function
signal=awgn(signal,5,'measured')
How much SNR do we have added to original signal?
I mean the SNR is 5 dB?
How can I add 20 dB noise to signal by using this command?
Like Dan has mentioned in the comments, the second argument is used to set the value of SNR.
However, this is under the assumption that your signal has a power of 0 dBW. In case the signal power is different, you need to increase (or decrease) the value of the snr argument appropriately.
I would like to get only one number (maximum) from sinusoid in Matlab Simulink scope. I have a voltage measurement to measure AC voltage and current measurement. I need to find max. In my example the voltage is 231V and current is 0.26. the result number is 231*0.26 = .. to multiple it I need to get the max number from sinusoid.
Thanks a lot.
Based on your description, I think that the MinMax Running Resettable block would be more appropriate for your application.
The MinMax block will take multiple scalar value inputs (or a vector input) and output the minimum or maximum value (depending on your settings) of those inputs at the current instant in time. This would be better used to compare two signals, not to find the maximum value of a particular "stream" of signal data.
So, for example, let's say that you have a Sine Wave block that is feeding into a MinMax block (which has been set to output the max value). The MinMax block will look at all of its inputs at the current instant in time and output the maximum value. However, in this case, MinMax only has one input -- the sine wave. So the output of MinMax will actually be the same as the output of the Sine Wave block.
On the other hand, MinMax Running Resettable outputs the minimum or maximum of all past inputs. So for example, if you had a sine wave with a peak value of 231 that was being fed into the u input of a MinMax Running Resettable block, then by the end of the simulation, this block will output 231. This is, of course, provided that your simulation has run long enough that the sine wave has reached its peak value.
Note that the MinMax Running Resettable block was an R input that can be used to reset the block. If you simply want to find the max value of your signal over time and do not need to reset the block, then you can go ahead and just leave this input disconnected.
i once studied matlab at engineering school and i think you need to link the output of your sinusoid to a box called minmax
http://www.mathworks.com/help/simulink/slref/minmax.html