I am supposed to create a function that takes any two radii and plugs them into the hollow sphere function/formula. But the function has to know which one is larger and assign the larger value to the outer radius. I am unsure how to do this. I thought I had solved it but I am getting a parse error on the last equals sign of the if statement. Here is what I have so far:
function [v] = hollow_sphere(outer_rad, inner_rad)v = (4*pi/3)*(outer_rad^3 - inner_rad^3);if inner_rad > outer_rad outer_rad = inner_rad && inner_rad = outer_rad;endend
Best Answer