|
17 | 17 | import matplotlib.pyplot as plt |
18 | 18 | import numpy as np |
19 | 19 |
|
| 20 | +plt.style.use("piezod") |
| 21 | + |
20 | 22 | from piezod import CantileverPiezoelectric, FluidType, PiezoMaterial |
21 | 23 |
|
22 | 24 | # ============================================================================= |
|
144 | 146 | v_sens_aln = c_aln.v_f_sensitivity(freq) |
145 | 147 | c_pzt.fluid = FluidType.AIR |
146 | 148 | v_sens_pzt = c_pzt.v_f_sensitivity(freq) |
147 | | -ax1.loglog(freq, v_sens_aln, "b-", linewidth=2, label="AlN") |
148 | | -ax1.loglog(freq, v_sens_pzt, "r-", linewidth=2, label="PZT") |
| 149 | +ax1.loglog(freq, v_sens_aln, "b-", label="AlN") |
| 150 | +ax1.loglog(freq, v_sens_pzt, "r-", label="PZT") |
149 | 151 | ax1.set_xlabel("Frequency (Hz)") |
150 | 152 | ax1.set_ylabel("Voltage Sensitivity (V/N)") |
151 | 153 | ax1.set_title("Voltage Mode Force Sensitivity") |
152 | 154 | ax1.legend() |
153 | | -ax1.grid(True, alpha=0.3) |
154 | 155 |
|
155 | 156 | # Plot 2: Voltage noise comparison |
156 | 157 | ax2 = axes[0, 1] |
157 | 158 | Vn_aln = c_aln.Vn(freq) |
158 | 159 | Vn_pzt = c_pzt.Vn(freq) |
159 | | -ax2.loglog(freq, Vn_aln * 1e9, "b-", linewidth=2, label="AlN") |
160 | | -ax2.loglog(freq, Vn_pzt * 1e9, "r-", linewidth=2, label="PZT") |
| 160 | +ax2.loglog(freq, Vn_aln * 1e9, "b-", label="AlN") |
| 161 | +ax2.loglog(freq, Vn_pzt * 1e9, "r-", label="PZT") |
161 | 162 | ax2.set_xlabel("Frequency (Hz)") |
162 | 163 | ax2.set_ylabel("Voltage Noise (nV/sqrt(Hz))") |
163 | 164 | ax2.set_title("Voltage Mode Noise") |
164 | 165 | ax2.legend() |
165 | | -ax2.grid(True, alpha=0.3) |
166 | 166 |
|
167 | 167 | # Plot 3: Force noise density (voltage mode) |
168 | 168 | ax3 = axes[1, 0] |
169 | 169 | Sfminv_aln = c_aln.Sfminv(freq) |
170 | 170 | Sfminv_pzt = c_pzt.Sfminv(freq) |
171 | | -ax3.loglog(freq, Sfminv_aln * 1e12, "b-", linewidth=2, label="AlN") |
172 | | -ax3.loglog(freq, Sfminv_pzt * 1e12, "r-", linewidth=2, label="PZT") |
| 171 | +ax3.loglog(freq, Sfminv_aln * 1e12, "b-", label="AlN") |
| 172 | +ax3.loglog(freq, Sfminv_pzt * 1e12, "r-", label="PZT") |
173 | 173 | ax3.set_xlabel("Frequency (Hz)") |
174 | 174 | ax3.set_ylabel("Force Noise (pN/sqrt(Hz))") |
175 | 175 | ax3.set_title("Force Noise Density (Voltage Mode)") |
176 | 176 | ax3.legend() |
177 | | -ax3.grid(True, alpha=0.3) |
178 | 177 |
|
179 | 178 | # Plot 4: Force noise density (charge mode) |
180 | 179 | ax4 = axes[1, 1] |
181 | 180 | Sfminq_aln = c_aln.Sfminq(freq) |
182 | 181 | Sfminq_pzt = c_pzt.Sfminq(freq) |
183 | | -ax4.loglog(freq, Sfminq_aln * 1e12, "b-", linewidth=2, label="AlN") |
184 | | -ax4.loglog(freq, Sfminq_pzt * 1e12, "r-", linewidth=2, label="PZT") |
| 182 | +ax4.loglog(freq, Sfminq_aln * 1e12, "b-", label="AlN") |
| 183 | +ax4.loglog(freq, Sfminq_pzt * 1e12, "r-", label="PZT") |
185 | 184 | ax4.set_xlabel("Frequency (Hz)") |
186 | 185 | ax4.set_ylabel("Force Noise (pN/sqrt(Hz))") |
187 | 186 | ax4.set_title("Force Noise Density (Charge Mode)") |
188 | 187 | ax4.legend() |
189 | | -ax4.grid(True, alpha=0.3) |
190 | 188 |
|
191 | 189 | plt.tight_layout() |
192 | | -plt.savefig("piezoelectric_cantilever_comparison.png", dpi=150) |
| 190 | +plt.savefig("piezoelectric_cantilever_comparison.png") |
193 | 191 | print("Saved comparison plot to: piezoelectric_cantilever_comparison.png") |
194 | 192 |
|
195 | 193 | # ============================================================================= |
|
0 commit comments