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

Posted 27 days ago
305 Views
|
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: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 Pi is the peak value of s in the first equation and sigma is the variance. Attachments:
7 Replies
Sort By:
Posted 27 days ago
 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 plotI 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
Posted 27 days ago
 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.
Posted 26 days ago
 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]; P:=Max[s[[i]]]; PSNR:=10 Log[(a[[i]]^2 P[[i]]^2)/sigma^2, 10]; {SNR[[1]],PSNR[[1]]} 
Posted 26 days ago
 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.
Posted 26 days ago
 Thank you John for your help. Please find attached the page of the material for proper understanding of what I intend to do.Regards Attachments: