필터 지우기
필터 지우기

What happened to my solver script?

조회 수: 2 (최근 30일)
imcuser1
imcuser1 2017년 6월 14일
댓글: imcuser1 2017년 6월 14일

I am studying the calculation of GPS coordinates. I am expecting matlab giving me the origin and zero clock offset. However Matlab hangs and unable to solve.

syms x y z t
sv1 = [1 0 0];
sv2 = [0 1 0];
sv3 = [0 0 1];
sv4 = [1 1 1];
prange = [1 1 1 sqrt(3)];
pos = solve( ...
'((x-sv1(1))^2 + (y-sv1(2))^2 + (z-sv1(3))^2)^0.5 + t = prange(1)', ...
'((x-sv2(1))^2 + (y-sv2(2))^2 + (z-sv2(3))^2)^0.5 + t = prange(2)', ...
'((x-sv3(1))^2 + (y-sv3(2))^2 + (z-sv3(3))^2)^0.5 + t = prange(3)', ...
'((x-sv4(1))^2 + (y-sv4(2))^2 + (z-sv4(3))^2)^0.5 + t = prange(4)', x, y, z, t);

채택된 답변

Steven Lord
Steven Lord 2017년 6월 14일
Don't pass char vectors into solve. If you're using release R2012a or later, use == to create your equations. We started warning about passing char vectors into solve in release R2015a, according to the Release Notes.
  댓글 수: 1
imcuser1
imcuser1 2017년 6월 14일
Thank you. Yes I use 2013a. Managed to make it work.
clear all; clc;
syms x y z t
sv1 = [1 0 0];
sv2 = [0 1 0];
sv3 = [0 0 1];
sv4 = [1 1 1];
prange = [1.1 1.1 1.1 sqrt(3.63)];
[a, b, c, d] = solve( ...
((x-sv1(1))^2 + (y-sv1(2))^2 + (z-sv1(3))^2)^0.5 + t == prange(1), ...
((x-sv2(1))^2 + (y-sv2(2))^2 + (z-sv2(3))^2)^0.5 + t == prange(2), ...
((x-sv3(1))^2 + (y-sv3(2))^2 + (z-sv3(3))^2)^0.5 + t == prange(3), ...
((x-sv4(1))^2 + (y-sv4(2))^2 + (z-sv4(3))^2)^0.5 + t == prange(4), x, y, z, t);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Physical Units에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by