Abstract Spherically symmetric anisotropic solutions that describe compact stellar objects within the framework of modified Rastall gravity are explored in this manuscript, where the non‐metricity scalar represented by and the trace of the energy‐momentum tensor is denoted by . To achieve this, the Karmarkar condition is applied and a relationship between the metric functions to solve the resulting field equations is established. In this framework, the field equations are constructed and the behavior of under two different scenarios is investigated. In the first scenario, a hybrid form is employed along with a linear equation of state , where and is an arbitrary constant, to derive the corresponding . In the second scenario, a logarithmic form of the coupling function is considered. The objective is to explore possible modifications to gravity by varying the parameters and in both cases, leading to hybrid, power‐law and exponential forms of gravity. The Key physical parameters such as matter variables, anisotropy, gradients, the equation of state parameter, mass function, energy conditions, and stability criteria to assess the physical acceptability of the models are explored. The observational data such as the mass and radius of the PSR J1416‐2230 pulsar are used. It is found that all the obtained solutions exhibit physically viable and stable behavior.
Ibrar et al. (Mon,) studied this question.