result is equal to a final value minus initial value, all divided for the initial value in matlab

You can calculate this value using the following formula:

main.m
result = (final_value - initial_value) / initial_value;
56 chars
2 lines

Where final_value is the final value you want to calculate the difference from, and initial_value is the initial value.

For example, if you want to calculate the difference between 10 and 5, divided by 5, you would use the following code:

main.m
initial_value = 5;
final_value = 10;

result = (final_value - initial_value) / initial_value;
94 chars
5 lines

This will result in a value of 1.

related categories

gistlibby LogSnag