how can i write function with the picture which i attached to the question?
2 次查看(过去 30 天)
显示 更早的评论
hey people
have a good time
i have a problem over the function which i attached to this Question.
i would like to write the function which take 2 variables (e.g. t and o)
and compute rmse and r^2 coefficient
can you help me out over this problem?
2 个评论
Geoff Hayes
2021-6-23
hadi - what have you tried so far? Please describe what you have attempted and discuss what problem or errors you are experiencing with your code.
回答(1 个)
Image Analyst
2021-6-23
Here's some help:
Also check out the sum() and sqrt() functions. To square, use the caret:
term1 = sum(O) ^ 2
Multiplication is * and division is /. Not hard. Just take it one term at a time:
term1 = ....
term2 = ....
denominator = ....
rSquared = ( (term1 - term2 * term3) / denominator) ^2
Or you can simply use the built in functions for mse() and corrcoef().
1 个评论
Image Analyst
2021-6-23
Sure we can help you but all you gave was a partial snippet of one of your attempts, which was just a partial snippet of my answer above:
function [term1 , term2] = stat(o , t)
term1=...
term2=...
end
It seems you forgot to upload your entire two code attempts so how can I comment on them? So I guess my answer stands as-is until you upload your code. Come on, you can do it, you're a smart engineer. It sounds like homework, and if so I'm sure your instructor didn't just say "See if someone in the Answers forum can do your homework problem for you."
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!