Message Boards Message Boards


Calculate seismic to signal ratio and peak seismic to noise ratio?

Posted 3 months ago
7 Replies
1 Total Likes

Dear All, I am a beginner in mathematica. Please, I want to write a mathematica code to calculate seismic-to-noise ratio using the equation:Signal to noise ratio equation

a is the amplitude scaling factor, s is the waveform and n is the noise. I have attempted to write the code as follows:

SNR = 10*Log*(Norm[s[[i]]^2, 2]/Norm[n[[i]]^2, 2], {i, nx})

I will also like to write a code to calculate peak signal to noise ratio using the equation peak signal to noise ratio Pi is the peak value of s in the first equation and sigma is the variance.

7 Replies

I'll try the 2nd eq. only. I assume you want each PSNR[i] calculated and accessible as array.

Do[PSNR[i] := 10 Log[(a[[i]]^2 P[[i]]^2/s^2), 10], {i, 100}]

Usually we do it like this (a List[]):

Table[10 Log[(a[[i]]^2 P[[i]]^2/s^2), 10], {i, 100}]

You could Enter as an input:

10 Log[(a[[i]]^2 P[[i]]^2/s^2), 10]

and Mathematic will have a button appear below it saying "Plot", if you just want to see the plot

I view .nb but i do not view .docx as i don't know what might happen if i open them and they are encrypted. Please share .nb

Thank you John for your response. I want the P in the second equation to be reading the maximum value of s in the first equation.

It makes no sense to say P[[i]] if P is the max of s. Perhaps you mean Max[s[[i]]].

P=Max[Table[s[[i]],{i,100}]]; (*no?*)
SNR:=10 Log[a[[i]]^2 Norm[s[[i]]^2, 2]/Norm[n[[i]]^2, 2],10];
PSNR:=10 Log[(a[[i]]^2 P[[i]]^2)/sigma^2, 10];

i cannot comment on "sigma" seismic-to-noise ratio variance without seeing the material your reading. there would be endless reasonings from which to make such a thing.

Thank you John for your help. Please find attached the page of the material for proper understanding of what I intend to do.



It is very unclear what you are asking. Please edit to add an explicit example of input and a clear description of desired output.

Thank you Daniel. I wish to calculate SNR for i traces as given by this equation: ![enter image description here][1]

where ai is the amplitude scaling factor, si is the signal in the trace and ni is the noise. I expect to see arrays of SNR for i traces. I also need a code to calculate PSNR using this equation: ![enter image description here][2]

where Pi is the peak value of si in the first equation and sigmal is the variance of the noise in the first equation. I attach the material in pdf that shows what I am trying to do. This is what I have so far:

SNR := Table[ 10Log[a[[i]]^2Norm[trs[[i]]^2, 2]/Norm[s[[i]]^2, 2], 10], {i, Length[trs]}];

P := Max[trs[[i]]];

PSNR := 10*Log[(a[[i]]^2 P[[i]]^2)/s^2, 10], {i, Length[trs]}; {SNR[[1]], PSNR[[1]]}

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract